I think there are two points of Correction, that must have been missed : 1. hash[s[l]]++ as we are removing it while shrinking the string len. 2. we need to increment the l pointer at the end of the while loop where while(count == m). Striver did a great job! Thanks
@venkatsai23256 ай бұрын
yeah u are right
@tharungr77016 ай бұрын
can you please paste the code here
@preetkhatri25186 ай бұрын
@@tharungr7701 here you go string minWindow(string s, string t) { int n=s.size(),m=t.size(); map mp; int l{},r{},cnt{}; int len{1000000009},idx=-1; for(int i=0;i0) cnt--; if(r-l+1
@mohitsingh67175 ай бұрын
@@tharungr7701 string minWindow(string s, string t) { string result; if(s.empty() || t.empty()) { return result; } unordered_map hash; for(int i = 0 ; i < t.size(); i++) { hash[t[i]]++; } int minlen = INT_MAX; int count = 0 ; int sindex = 0 ; int r = 0 , l = 0 ; while(r < s.size()) { if(hash[s[r]] > 0 ) { count++; } hash[s[r]]--; while(count == t.size()) { if(r- l +1 < minlen) { minlen = r-l+1; sindex = l; } hash[s[l]]++; if(hash[s[l]] > 0 ) { count = count -1; } l++; } r = r + 1; } return minlen ==INT_MAX ? "": s.substr(sindex , minlen);
@KapilSharma564195 ай бұрын
@@tharungr7701 class Solution { public: string minWindow(string s, string t) { int n = s.length(); int m = t.length(); if (m > n) { return ""; } int minLength = INT_MAX; int sIndex = -1; map mp; for (int i = 0; i < m; i++) { mp[t[i]]++; } int l = 0, r = 0; int cnt = 0; while (r < n) { if (mp[s[r]] > 0) { cnt++; } mp[s[r]]--; while (cnt == m) { if (r - l + 1 < minLength) { minLength = r - l + 1; sIndex = l; } mp[s[l]]++; if (mp[s[l]] > 0) { cnt--; } l++; } r++; } return sIndex == -1 ? "" : s.substr(sIndex, minLength); } };
@nikhilaks24077 ай бұрын
Thank you striver for the awesome playlist🎉🎉🎉🎉 In the optimal approach there was a slight mistake, inside the nested loop it should be hash[s[l]]++ instead of hash[s[l]]-- and after the check for if(hash[s[l]]>0)cnt--; , a line needs to be added for l++; to shrink the window c++ updated code - class Solution { public: string minWindow(string s, string t) { if (s.empty() || t.empty()) { return ""; } vectorhash(256,0); int l=0,r=0,minlen=INT_MAX,sind=-1,cnt=0; int n=s.size(),m=t.size(); for(int i=0;i
@MayankPareek7 ай бұрын
Hey can anyone tell me where is the mistake in my code its not passing all test cases. class Solution { public String minWindow(String s, String t) { char[] hash = new char[256]; for (int i = 0; i < t.length(); i++) hash[t.charAt(i)] += 1; int l = 0, r = 0, sIndex = -1, minlen = Integer.MAX_VALUE, count = 0; while (r < s.length()) { if (hash[s.charAt(r)] > 0) count++; hash[s.charAt(r)] -= 1; while (count == t.length()) { if (r - l + 1 < minlen) { minlen = r - l + 1; sIndex = l; } hash[s.charAt(l)] += 1; if (hash[s.charAt(l)] > 0) count--; l++; } r++; } if (sIndex != -1) return s.substring(sIndex, sIndex + minlen); return ""; } }
@varun10176 ай бұрын
thank you bhaii
@mohitthakur59046 ай бұрын
@@MayankPareek facing the same error in java.
@MayankPareek6 ай бұрын
@@mohitthakur5904 take integer array instead of char array
@deeptitanpure18545 ай бұрын
@@MayankPareek While initializing the hash you should use : int[] hash = new int[256]; Was there any reason why you chose to do a: char[] hash = new char[256];
@parth_38567 ай бұрын
BTW! LOVED THE NEW WEBSITE INTERFACE.............MORE POWER AND SUCCESS TO YOU STRIVER AND HIS TEAM.
@ansulluharuka92437 ай бұрын
i am not able to login, are you able to?
@parth_38567 ай бұрын
@@ansulluharuka9243 yes! but i think there still some work is being done, so that may have caused u some problem in login, BUT let me tell you it's wind in there.
@ManishYadav-yp2mi7 ай бұрын
@@ansulluharuka9243 same here
@ShrutiSangam-u2s7 ай бұрын
same@@ansulluharuka9243
@nothingmuch1407 ай бұрын
@@ansulluharuka9243 Same broo
@nuraynasirzade7 ай бұрын
The new website is just amazing! I don't have words to say!!!!!! AMAZING!🤩🤩🤩and all of that for free!
@sandeepyadav-es9yz6 ай бұрын
completed this playlist today 27-05-2024 thanks striver!!
@vineetsingh47077 ай бұрын
Completed this whole playlist in a single day. Thanks Striver for this. The way you teach makes me sit for long, think and implement and gradually the concepts start getting crystal clear.
@Quavo-goa7 ай бұрын
like all of the 283? videos
@lakshsinghania6 ай бұрын
@@Quavo-goa lmao
@Tushar_9956 ай бұрын
@@lakshsinghania Hey ! Is sequence of this playlist proper and completed ?
@lakshsinghania6 ай бұрын
@@Tushar_995 yeah it is, u can blindly follow it just the last qs which is given in the A2Z sheet is not covered here, otherwise good to go
@Tushar_9956 ай бұрын
@@lakshsinghania Ok ! I was thinking to start DSA but was confused between a LOT of channels and paid courses
@Beeplov23375685 ай бұрын
There was a slight mistake in the video. 1]. l++ in the while(cnt==m). 2]. It should be mp[s[l]]++; instead of mp[s[l]]--; in while(cnt==m) loop. string minWindow(string s, string t) { int l = 0, r=0; int n = s.size(), m = t.size(); int cnt = 0, minLen = 1e7; int startInd = -1; mapmp; for(int i=0;i
@lovegoyner74504 ай бұрын
Yep I noticed this too 😊
@rkraj33394 ай бұрын
s.substr(startind,strtind+minLen)
@lovegoyner74504 ай бұрын
@@rkraj3339 no this is wrong
@MohitReddyDadireddy-ex5pp4 ай бұрын
Yes
@kushmehta68233 ай бұрын
Hii i found a minor bug, i guess the corrected version should be a bit like this if (mp.find(s[l]) != mp.end()) { mp[s[l]]++; if (mp[s[l]] > 0) cnt--; } because we first have to check whether the character that my left pointer points to even exists in the string t or not if it does not then i dont think i should decrease the count because i still have substrings to measure
@VirajChokhany3 күн бұрын
I'm so happy. I could do this by myself. Thanks Striver !!
@anubhabdas95535 ай бұрын
Completed the playlist within a day. Sliding window is usually an easier topic as it is totally intuition based, but to identify the patterns and making a structure for all the solutions, you made it look like piece of a cake. Thanks Striver
@captain-ne8qy4 ай бұрын
Why do we store the starting index in brute foce approach ? Can you please explain it to me?
@anubhabdas95534 ай бұрын
@@captain-ne8qy in the question we have to return our resultant substring right? So here we are iterating and all. Everything is fine but to return the substring, what do we want .....the first index of the substring, that is from where the substring is starting and the size so that we can calculate at what index the substring is ending, that's why we are storing both the starting index and size of the substring
@captain-ne8qy4 ай бұрын
Thnqu for the explanation!
@SAIGOVINDSATISH8 ай бұрын
Make playlist on CP problems for each algorithms atleast 30 each topic from 1200 div to 1800div CP SHEET of yours has very less problems except for dp and math 😢
@pratikgupta73738 ай бұрын
Master of consistency🎉
@rayansailani446520 күн бұрын
Adding this comment for understanding of anyone confused: In sliding window problems we're always thinking of expanding or shrinking of window. So when we think of shrinking of window for further iterations, we thinking of adding back the value of map in the inner loop. Here's my code for understanding: class Solution { public String minWindow(String s, String t) { int n = s.length(); int m = t.length(); int index = -1; int minLength = Integer.MAX_VALUE; Map mem = new HashMap(); int count = 0; int start = 0; // populating the map with values from t array for(int i = 0; i 0) count--; start++; } } return index == -1 ? "" : s.substring(index, index + minLength); } }
@kushal82618 ай бұрын
it should be hash[s[left]]++
@AdityaGarg-hl7ri7 ай бұрын
also left++
@tharungr77016 ай бұрын
can you please paste the code here
@nehasingh81816 ай бұрын
Amazing work, Striver! You guys are really doing a great job for us by providing such a brilliant DSA course for free. It's genuinely useful for me. Please upload videos on strings in Striver's A2Z DSA Course/Sheet.......😇
@mukeshjadhav10647 ай бұрын
Hi striver , best series in the whole world and can you please bring playlist on basics of string
@janaSdj5 ай бұрын
Have completed sliding window playlist. Learned many things. Thank you so much...
@angelinsnehav33544 күн бұрын
Amazing Playlist💯, understood everything!
@arka512x2 ай бұрын
Corrected Java Solution- class Solution { public String minWindow(String s, String t) { int m = s.length(); int n = t.length(); if (m < n) return ""; // If s is smaller than t, no valid window exists // Frequency array for characters in t int[] hashArr = new int[128]; // Use 128 since characters can be lowercase and uppercase for (int i = 0; i < n; i++) { hashArr[t.charAt(i)]++; } int l = 0, r = 0; int ct = 0; // Count of matching characters int minLen = Integer.MAX_VALUE; // Initialize minLen to a large value int sIndex = -1; while (r < m) { // Expand window by moving r char rightChar = s.charAt(r); if (hashArr[rightChar] > 0) { ct++; } hashArr[rightChar]--; // Decrease the count for the current character // When we have a valid window, try to minimize it while (ct == n) { if (r - l + 1 < minLen) { minLen = r - l + 1; sIndex = l; } // Contract the window by moving l char leftChar = s.charAt(l); hashArr[leftChar]++; // Increase the count back when moving left if (hashArr[leftChar] > 0) { ct--; // Decrease the match count if a necessary character is lost } l++; } r++; } // Return the smallest window or an empty string if no window was found return sIndex == -1 ? "" : s.substring(sIndex, sIndex + minLen); } }
@tanazshaik678Ай бұрын
that was pretty clear, thanks
@blurbmusic15072 ай бұрын
heads off to you sir what a great explanation !!!! pure genius❤
@vijeshsshetty5 ай бұрын
Best Playlist on Sliding Window. Thanks Striver !!
@NonameNoname-f2t7 ай бұрын
loved this sliding window playlist ♥
@ManishKumar-dk8hl8 ай бұрын
recursion ki new playlist bhi le aao ( JAVA ) :---- class Solution { public String minWindow(String s, String t) { int l=0; int r=0; HashMap mpp=new HashMap(); int cnt=0; int sindex=-1; int minlen=Integer.MAX_VALUE; String st=""; for(int i=0;i
@bruvhellnah6 ай бұрын
Aur kitne playlist chahie recursion ke tujhe bhai?
@justanuhere4 ай бұрын
thank u
@akshatjoshi79285 ай бұрын
I enjoy grasping from your videos StriverBhai !! I wanted to highlight one mistake in code that inside while(cnt==m) you did hash[s[l]]-- but it should be hash[s[l]]++ as the condition is if(hash[s[l]]>0) cnt--; and you forgot to write l++ as well.
@hetpatel73997 ай бұрын
New website is very good.... Nice work sir;🎉
@divyanshbhatt82737 ай бұрын
thank you striver for this amazing playlist !!
@parassingh38776 ай бұрын
Day 2 of asking Hey Striver, When can we expect solution videos for Strings, Stack and Queues, few Recursion videos as these are on top of queue, for A to Z sheet everyone needs them Love your content and teaching methods way from Brute to Optimum teaches us alot
@jatinsingh72096 ай бұрын
I think there is slight correction in the pseudocode, I made these corrections while doing the problem I am posting it here ya'll can refer to it if you are facing problem, " map mp; for(int i=0;i
@Cool962676 ай бұрын
Thankyou so much Striver for all you efforts throughout in delivering us so much valuable content. Any student / working professional can now be able to transition their career without paying money for courses. Would also like your insights on the point : While preparing for interviews most of the aspirants are going through the videos solely and solving the question after completely watching the video. And also are feeling lazy trying to solve the question on our own. What is the best way to complete any topic without being lazy and how should an aspirant approach any topic/playlist?
@akashharad42036 ай бұрын
Thank you you are so much hard working keep doing we have less good resources to learn like you
@MayankPareek7 ай бұрын
Hey can anyone tell me where is the mistake in my code its not passing all test cases. class Solution { public String minWindow(String s, String t) { char[] hash = new char[256]; for (int i = 0; i < t.length(); i++) hash[t.charAt(i)] += 1; int l = 0, r = 0, sIndex = -1, minlen = Integer.MAX_VALUE, count = 0; while (r < s.length()) { if (hash[s.charAt(r)] > 0) count++; hash[s.charAt(r)] -= 1; while (count == t.length()) { if (r - l + 1 < minlen) { minlen = r - l + 1; sIndex = l; } hash[s.charAt(l)] += 1; if (hash[s.charAt(l)] > 0) count--; l++; } r++; } if (sIndex != -1) return s.substring(sIndex, sIndex + minlen); return ""; } }
@aspirant84096 ай бұрын
take Integer array instead of CharArray
@MayankPareek6 ай бұрын
@@aspirant8409 thanks brother
@zorith7 ай бұрын
i lost all my progress with the new website update, when i logged in it again and marked my progress i lost it again and it says unautorized . The old website ui was much user friendly and better . The new update just made it more complex to navigate
@aditya_raj78277 ай бұрын
yeah i also lost my progress data
@NonameNoname-f2t7 ай бұрын
sign out and sign in again and refresh the page
@AmruthavarshiniMavuri7 ай бұрын
you can view ur notes under saved notes
@justlc76 ай бұрын
++, lost all data, and new website doesnt save data, keeps reseting.
@stith_pragya7 ай бұрын
Understood...Thank You So Much for this wonderful video...🙏🙏🙏
@gousikram8490Ай бұрын
in the brutal force for(j= i -> n) this was mistake
@gousikram8490Ай бұрын
j=i is correct not j=0
@Abhinavkirtisingh7 ай бұрын
Hey Striver, I watch all of your videos and love the way you explain things. I am stuck on a problem called Josephus Problem from a quite long time. Please make a video on it.
@parth24392 күн бұрын
understood, Thank you striver !
@popli105 ай бұрын
Thanks Striver. Will always be grateful to you big brother
Day 1 of asking Hey Striver, When can we expect solution videos for Strings, Stack and Queues, few Recursion videos as these are on top of queue, for A to Z sheet everyone needs them Love your content 🦾🦾 and teaching methods way from Brute to Optimum teaches us alot
@guneeshvats46Ай бұрын
Amazing explanation!!
@vtravels2920Ай бұрын
Our sole companion in the journey through Striver's A-Z playlist is his receding hairline.
@user-fw4kz3bb4g7 ай бұрын
MUCH MUCH MUCH love for your efforts @Striver, the new Website UI Rocks!! Also, can you please tell the ETA for string playlist? I'm really holding on from watching others' videos just so that I can follow yours ;)
@hashcodez7572 ай бұрын
"UNDERSTOOD BHAIYA!!"
@sparksfly44214 ай бұрын
when we are using the left iterator to pop the letter out, shouldn't we use "hash[s[left]]++" to increase the frequency of that letter in the hashmap instead and also add a "left++" after it to keep the "shrinking" going?
@priyanshugagiya45157 ай бұрын
24:40 it should be hash[s[l]]++; l++;
@--KarthikeyanS7 ай бұрын
hey Striver ,you forgot to increment the l pointer and also in hash[s.charAt(l)]--; it should decrese the number but the value is increasing (example for d -> -2 if we perform hash[s.charAt(l)]--; (-2-1 => -3) so it should be hash[s.charAt(l)]++; (-2+1 => -1) thanks for the amazing Playlist.
Hey Striver, Its been 40 days. Please upload recursion patten wise video first . because recursion is required in advance topic like DP and graphs. So if we have recursion playlist complete we can go to DP and graph with confidence
@anmolbansal40096 ай бұрын
bhaii tu toh wo nakli binod tharu hai na😂😂......videos bnana chhodh diya kya bhaii??
@MayankPareek6 ай бұрын
@@anmolbansal4009 yes right now , I have a job in Infosys.
Please make a playlist on Heaps and Priority Queue Sir. Since Placement session is going too start requesting you to please upload it soon. Please Sir.
@wajahatahmed2104Ай бұрын
Very good but I think you forget to add l++ and hash[s[l]]++ should be there.
@torishi826 ай бұрын
Understood brother. Thank you so much.
@RonitSagar4 ай бұрын
A little catch .......my code was not running when I am executing from j=0 for the inner loop , so if it does not work for u also, just take j=i and check other logic it will work !! below my code Brute Force class Solution { public String minWindow(String s, String t) { int length=Integer.MAX_VALUE; int start=-1; for(int i=0;i
@MayankPareek7 ай бұрын
Hey Striver, I know you have very busy schedule but please drop playlist quicker. Because I started Binary tree as all other playlist before it was completed. But on the hard question it require proper knowledge of Queue and Stack , Priority Queue. Which is not completed in the playlist. So learning became difficult. Hope you understand.
@akansha5387 ай бұрын
bhaiya recursion aur greedy ki bhi ek playlist bana do pls
@shashanknakashe33395 ай бұрын
thanks striver for this problem statement here is the optimal solution with comments that will help me and you when we do revision for this type of question class Solution { public: string minWindow(string s, string t) { // if(s == t) return s; // if the both strings are equal then we dont have to go down; int cnt = 0; int minLen = INT_MAX; int l= 0; int r =0; int n = s.size(); int index = 0; //creating the hash map to keep therecord of the value unordered_map mpp; for(int i =0 ; i< t.size(); i++){ mpp[t[i]]++; //making flags so that they will help us for the count; } while(r= 0){ cnt ++; } //making the condition for the count while(cnt == t.size()){ //setting the index according the min length if(r-l+1 < minLen){ index = l; //then you update the index; } //first we get the current length and compaire it with our minLen minLen = min( minLen, r-l+1); //now we try to shrink the substring therefore we move l++; mpp[s[l]]++; if(mpp[s[l]] == 1){ cnt = cnt-1; } l++; } //after shirinking we need to extend r++; } //if wwe want to send "" string as an output if(minLen == INT_MAX) return ""; //getting the stirng by the size minLen // index to minLen; wala part return s.substr(index, minLen); } }; keep liking this comment so youtube will notify me about this imp question :) :)
@glyoxal193323 күн бұрын
class Solution { public String minWindow(String s, String t) { int count = 0; int[] hash = new int[256]; int sIndex = -1; int n = s.length(); int m = t.length(); int minLen = Integer.MAX_VALUE; int left = 0; int right = 0; for(int j=0; j0) count--; left++; } right++; } return sIndex==-1?"":s.substring(sIndex,sIndex+minLen); } }
@singhji41498 ай бұрын
Nice video, good learning, but can u cover sliding window plus binary search coding question
@mriit30257 ай бұрын
NOTE : MISTAKE in video ⚠⚠⚠⚠⚠⚠ here is the correct code : class Solution { public: string minWindow(string s, string t) { unordered_map freq; for(char c : t) { freq[c]++; } int l = 0, r = 0, minLen = INT_MAX, si = -1, cnt = 0; while(r < s.size()) { if(freq[s[r]] > 0) cnt++; freq[s[r]]--; while(cnt == t.size()) { if(r - l + 1 < minLen) { minLen = r - l + 1; si = l; } freq[s[l]]++; if(freq[s[l]] > 0) cnt--; l++; } r++; } return si == -1 ? "" : s.substr(si, minLen); } };
@amansinghal24317 ай бұрын
Hey Striver, I am unable to login to the AtoZ dsa sheet after you updated it. Logged in through google earlier. Could you please check?
@rock89387 ай бұрын
Same issue with me
@ujjwalkumarsavita49992 ай бұрын
Jai hoo 👍 khatam hui playlist
@ABINITHT7 ай бұрын
striver when will you upload videos on strings in AtoZ dsa playlist,please upload the video
@brp35227 ай бұрын
Anyone else is having issues with the new website? I am seeing unauthorized. As soon as I sign it is all fine but when I go to A2Z sheet or any section of the website it says that Unauthorized. Why is it happening
@anmolbansal40097 ай бұрын
did u get the solution to correct it?
@ramesh68442 ай бұрын
Nice explanation
@mightytitan17198 ай бұрын
Bro's the 🐐
@mohitjangid00276 ай бұрын
Bhaiya please upload video in A2Z playlist because you only hope for me
@vikkaashl6 ай бұрын
pls post java collections vidoes it will be very usefull for the people who are solving the problems in java
@thisisRandom-ut9iq3 ай бұрын
Please do string playlist!
@AdityaKumar-be7hx7 ай бұрын
The C++ solution for reference: class Solution { public: string minWindow(string s, string t) { int left=0, right=0, n=s.length(), minLen=INT_MAX, start=-1; unordered_map freq; for(auto ch:t) ++freq[ch]; int count=freq.size(); for(right=0; right
@xavier41078 ай бұрын
Bhayy... Please do more videos on this playlist.
@tanaygada9145 ай бұрын
if anyone needs corrected code string minWindow(string s, string t) { int right=0, left=0, n = s.size(); map mp; for(auto i : t){ mp[i]++; } int minLen = INT_MAX; int startInd = -1; int cnt = 0; int m = t.size(); while(right0) cnt++; mp[s[right]]--; while(cnt==m){ if(minLen>right-left+1){ minLen = right-left+1; startInd = left; } mp[s[left]]++; if(mp[s[left]]>0) cnt--; left++; } right++; } if(startInd==-1) return ""; return s.substr(startInd,minLen); }
@maanavgurubaxani41667 ай бұрын
bhaiya website update hone ke baad jab koi bhi topic ke article kholte hai to undefined tutorial likha ata hai....The articles are not opening.If possible please resolve this issue as soon as possible.It will be a great help.Thank you.....
@MagicDiamondUniverse7 ай бұрын
Please put separate solution videos for all the graph questions
@MayankPareek7 ай бұрын
last question video of two pointer and string playlist, drop it soon please
@ashishpradhan62504 ай бұрын
Op...mind blowing algorithm
@limitless61898 ай бұрын
string playlist when
@premkulkarni75786 күн бұрын
class Solution { public: string minWindow(string s, string t) { int n = s.size(); unordered_mapump; for (int i=0 ; i 0){ cnt += 1; } while (cnt == t.size()){ if (r-l+1 < min_len){ min_len = r-l+1; min_index = l; } ump[s[l]]++; if (ump[s[l]] > 0){ cnt -= 1; } l++; } ump[s[r]]--; r++; } string s1 = s.substr(min_index , min_len); if (min_len == INT_MAX){ return ""; } return s1; } }; Striver's Most Optimal Approach
@SOURAVROY-ko3os7 ай бұрын
In the Brute Force Solution 'j' should be start from 'i', rather than '0'.
@priyaanshusoni6 ай бұрын
Bss Ab STRINGS ki playlist le aao bhaiya please !
@dasarivamsikrishna95947 ай бұрын
Bro, There is no links of gfg in strivers A2Z sheet, Please enable gfg links It could be more helpful to practice .
@techyguyaditya7 ай бұрын
Striver won't do it, because it's all about business and giventake. GFG stopped giving commissions to him, so he purged all gfg links.
@adityababu34055 ай бұрын
class Solution { public: string minWindow(string s, string t) { if (s.empty() || t.empty()) { return ""; } vectorhash(256,0); int l=0,r=0,minlen=INT_MAX,sind=-1,cnt=0; int n=s.size(),m=t.size(); for(int i=0;i
@pushkarbopanwar32975 ай бұрын
CODE IN C++ class Solution { public: string minWindow(string s, string t) { unordered_map mpp; int l=0,r=0,c=0,m=t.size(),index,minlen=INT_MAX; for(int i=0;i
@Sharath_Codm7 ай бұрын
Please update string videos 😥
@iamnoob75936 ай бұрын
What a playlist , Amazing Thanks Striver
@angeldeveloper8 ай бұрын
Thanks a ton🎉🎉
@Myanmartiger9217 ай бұрын
Anyone completed the playlist anything that is missing?
@amitnagdev706115 күн бұрын
a situation where, after shrinking the window and finding that the window is invalid, we discover that the required character will not appear again later in the string. What should we do in such a case?
@amitnagdev706115 күн бұрын
try using this string "ddaaabbcd" you will get more nuance of it.
@franciskp91177 ай бұрын
Hey man can you upload the solution for minimum window subsequence also ?
@dhruvmishra97817 ай бұрын
you forgot to l=l+1 at the end;
@SuvradipDasPhotographyOfficial5 ай бұрын
class Solution { public: string func(string s, string t){ int n = s.size(), m = t.size(); int i = 0, j = 0, startindx = -1, minlen = INT_MAX, cnt = 0; map freq; for(auto a : t){ freq[a]++; } while(j < n){ if(freq[s[j]] > 0){ cnt++; } freq[s[j]]--; while(cnt == m){ if(j - i + 1 < minlen){ minlen = j - i + 1; startindx = i; } freq[s[i]]++; if(freq[s[i]] > 0){ cnt -= 1; } i++; } j++; } cout
@limitless61898 ай бұрын
we need stringsssss
@RISHABHKUMAR-w5z5 ай бұрын
In the first approach, the nested for loop should be from j=i to n instead of j=0 to n, because we are checking for each substring DOES ANYBODY THINKS THE SAME ?
@rock89387 ай бұрын
I am unable to login with my google account after update
@tejasjaulkar96587 ай бұрын
when we click on open in new tab (video)both videos started and sounds mixed together .....so may be we can inhace this loop hole of new website master
@mohankkkrishna80367 ай бұрын
Would you please make a videos on strings 😊😊😊
@AyushMishra-lb6do7 ай бұрын
some issue occurs in your website take you forward when i click mark option page says unauthorised please solve it ..
@akashsoam75817 ай бұрын
prefix sum playlist too. Please sird
@saravna6 ай бұрын
Having trouble in accessing the website, the progress is not getting updated, it shows "Unauthorized" error message
@manishmodi86626 ай бұрын
Gen AI would change the world of learning. For one simple problem I wouldn't need to spend 20 mins watching a video. This is my hypothesis. I may be wrong.