Minimum Window Substring | Variable Size Sliding Window

  Рет қаралды 202,888

Aditya Verma

Aditya Verma

Күн бұрын

Пікірлер: 735
@rohitlandge3890
@rohitlandge3890 3 жыл бұрын
Concise code for the problem: string minWindow(string s, string t) { unordered_map mp; int minlen=INT_MAX, start=0; for(auto ch:t){ mp[ch]++; } int i=0,j=0,count=mp.size(); while(j
@sarveshmaurya2168
@sarveshmaurya2168 2 жыл бұрын
commenting for better reach ( according to the explanation) great
@MaheshKumar-ur8hq
@MaheshKumar-ur8hq Жыл бұрын
CFBR
@littleworld3021
@littleworld3021 10 ай бұрын
CFBR
@DarthVader678
@DarthVader678 9 ай бұрын
Please note that instead if(mp[s[i]]==1) it will be if(mp[s[i]] > 0)
@KaranSaini-uw7yi
@KaranSaini-uw7yi 9 ай бұрын
good
@TheAdityaVerma
@TheAdityaVerma 3 жыл бұрын
I haven't included the code of this problem in this video and not uploading it right now (although I have it ready): for two reason: 1) Video was getting too long. 2) I want you guys to do it by yourself, since this will be last video in this series and this is the "BAAP" problem of sliding window, if you can do it, I can assure you will be able to do almost any sliding window problem. Try it by yourself, I will upload soon :)
@nishthagoel7542
@nishthagoel7542 3 жыл бұрын
Thank you so much, Aditya. Pleaseee upload BFS & DFS (i am having trouble with imp questions like number of islands etc) your videos have been very helpful :)
@akhilmehta8248
@akhilmehta8248 3 жыл бұрын
Hello, I tried to write its code, but getting few errors. Can you please upload the code on github or in another video?
@devilronak7262
@devilronak7262 3 жыл бұрын
Bhai you are great your videos are very helpful, plz make videos on backtracking plz🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏
@rv0_0
@rv0_0 3 жыл бұрын
upload nhi kiye
@rubinip1956
@rubinip1956 3 жыл бұрын
Kindly add subtitles..so it Will be useful for everyone
@mayank6023
@mayank6023 3 жыл бұрын
Vote for backtracking series.
@Jadon09
@Jadon09 3 жыл бұрын
@Aditya verma what does it mean?
@achintyaveersingh4651
@achintyaveersingh4651 3 жыл бұрын
@@Jadon09 It's a traveling fake salesman problem
@SoftwareDeveloper86
@SoftwareDeveloper86 3 жыл бұрын
definetly intrested,
@dhirendrasingh6071
@dhirendrasingh6071 Жыл бұрын
This is his last uploaded video
@Mohit-gb9dv
@Mohit-gb9dv Жыл бұрын
@rithikraj1813
@rithikraj1813 3 жыл бұрын
I tried to find your social media link but couldn't find it, because of you only got placed in VMware Interview mei pucha mrese ki node to node max sum path ka value nikalna h aur hm yeh thumb nail mei dekhe the yaad tha qstn but soln nii aata tha ab hmko smjh nii aara tree mei dp kaise lgega kahe ki yeh dp playlist mei h aur interviewer smjh gya ki hmko yeh qstn aata nii h kahe ki hm bhot cross qstn krre end mei solve huaa aur vo next Interviewer ko itna aacha review diye ki baapre kisi ne reject nii krra aur mreko hr mei bola gya face mei ki I got selected for intern + fte Bhai sir literally bow to your expertise ❤️❤️ aur stack ko sort krne v bola recursively vo v bna diye hm uska v video h apka playlist mei bhai bnate rhiye aisa video bhot help hota h ❤️❤️
@haritmohan1326
@haritmohan1326 3 жыл бұрын
Hello Sir, I never thought coding could be this enjoyable before watching ur videos, eagerly waiting for your series of GRAPHS and TREES.☺️
@Ash-fo4qs
@Ash-fo4qs 2 жыл бұрын
yes graph and all the other remaining topics🙈.
@akankshasinha3352
@akankshasinha3352 2 жыл бұрын
Hi … please tell , how to build concept for rest of the linkedlist and trees kind of problem? Cz everything is not covered on this channel ! 🥺😔 gimme some ideas
@ytg6663
@ytg6663 2 жыл бұрын
Keep waiting 😂😂😂
@ytg6663
@ytg6663 2 жыл бұрын
@@akankshasinha3352 u may refer to other channel take u forward / striver / techdose
@VinayKumar-ze2ww
@VinayKumar-ze2ww 2 жыл бұрын
@iblis take u forward
@Omchaudhary07
@Omchaudhary07 16 күн бұрын
Generally, I don’t comment on any video, but this is genuinely the best video because it teaches how we should approach a problem. I've seen many tutors, but they mainly focus on solving a problem, whereas he is the only one who explains how we should approach it
@mrugeshsabalpara6755
@mrugeshsabalpara6755 3 жыл бұрын
Idea behind iterating Given String length can thought as : 1) Iterate thru string S till the count [map size from String T characters] variable reaches to 0. 2) Once counter is 0, try to move the start pointer towards end pointer to minimize the length of the found substring. If character at start pointer matches with string T increment the count variable. Loop thru till count variable is 0. // String s = "timetopractice"; String t = "toct"; int sLen = s.length(); int tLen = t.length(); if(tLen > sLen) System.out.println("Invalid Input"); HashMap countMap = new HashMap(); for (char c: t.toCharArray() ) { countMap.put(c,countMap.getOrDefault(c,0) + 1); } int start = 0; int end = 0; int maxLen = Integer.MAX_VALUE; int maxStart = 0; // to track Start index of substring int maxEnd = 0; // to track End index of substring int count = countMap.size(); while (end < sLen){ char tempCharEnd = s.charAt(end); if(countMap.containsKey(tempCharEnd)){ countMap.put(tempCharEnd,countMap.get(tempCharEnd) - 1); if(countMap.get(tempCharEnd) == 0){ count--; } } while (count == 0) { if(maxLen > end - start + 1) { maxLen = end - start + 1; maxStart = start; maxEnd = end + 1; } char tempCharStart = s.charAt(start); if (countMap.containsKey(tempCharStart)) { countMap.put(tempCharStart, countMap.get(tempCharStart) + 1); if (countMap.get(tempCharStart) > 0) { count++; } } start++; } end++; } System.out.println(maxLen); System.out.println("Start Index : " + maxStart +" End Index :" + maxEnd + ": "+ s.substring(maxStart,maxEnd));
@adityajain5101
@adityajain5101 2 жыл бұрын
string result=""; unordered_map mp; for(int m=0;m
@akankshasinha3352
@akankshasinha3352 2 жыл бұрын
Hi … please tell , how to build concept for rest of the linkedlist and trees kind of problem? Cz everything is not covered on this channel ! 🥺😔 gimme some ideas
@arpankesh872
@arpankesh872 2 жыл бұрын
@@adityajain5101 Try this one, it passes all the test cases. In your code it should be if(mp[s[i]] > 0) count++; My code :- string result=""; unordered_map mp; for(int m=0;m
@kunaldas9284
@kunaldas9284 2 жыл бұрын
you don't need maxEnd if you've already found the min lngth i.e. s.substring(maxStart, maxStart + maxLen+1)
@debangshubanerjee1311
@debangshubanerjee1311 2 жыл бұрын
The condition - if (countMap.get(tempCharStart) > 0) { count++; } is wrong coz here count represents the count of distinct characters, not the count of all characters. It should be -: if (countMap.get(tempCharStart) =1) { count++; }
@JangBahadur3028
@JangBahadur3028 3 жыл бұрын
Aditya bhaai, please upload your videos more frequent like before... I'm preparing for interviews and need your styled videos on backtracking and greedy algorithms. You are my favourite teacher.
@Abc-lr4bf
@Abc-lr4bf Жыл бұрын
WOW aditya bhayia, kitna badia samjhaya hai aapne , khud se code pass karvane ki jo khushi hoti hai na kya hi batau , thanks a lot
@krishgarg5665
@krishgarg5665 2 жыл бұрын
I am in 4th year and I feared coding from 1st year but YOU HAVE REMOVED MY FEAR!! God bless you, love you bhai...please cover all the topics like graphs and trees as well
@vivekswami2182
@vivekswami2182 Жыл бұрын
already covered by striver
@NewBIE-xz5jm
@NewBIE-xz5jm 9 ай бұрын
Then why are you here! lol @@vivekswami2182
@rupalitiwari5012
@rupalitiwari5012 2 жыл бұрын
Thanks Aditya. Below is the java solution based on this explaination. Java Solution : class Solution { public String minWindow(String s, String t) { String ans=""; int i=0,j=0; int min=Integer.MAX_VALUE; HashMap map=new HashMap(); for(int k=0;k0) count++; i++; } if(count==0) { if(min>j-i+1) { ans=s.substring(i,j+1); min=j-i+1; } } } } j++; } return ans; } }
@mysterious5729
@mysterious5729 7 ай бұрын
Here is bit improved code class Solution { public String minWindow(String s, String t) { String ans=""; int i=0,j=0; int min=Integer.MAX_VALUE; HashMap map=new HashMap(); for(int k=0;k0) count++; } i++; } } } return ans; } }
@itsrahimuddinkhan
@itsrahimuddinkhan 3 жыл бұрын
Please start a series on trees and graphs.
@shashwatrai1989
@shashwatrai1989 3 жыл бұрын
Bhaiyya we really need more content! You have spoiled us so much that we cannot settle for anyone else! Please consider doing a series on graphs and/or backtracking.
@sriramkrishnamurthy4473
@sriramkrishnamurthy4473 3 жыл бұрын
Bruh
@sohamnandi4708
@sohamnandi4708 3 жыл бұрын
Please make a Series on Backtracking, Graph, Tree, Hashing & Number System
@ritikshandilya7075
@ritikshandilya7075 7 ай бұрын
Aditya bhai , sari playlist ka security tight krva lo . Its PURE GOLD 🔥. Thanks for great approach
@divyranjan254
@divyranjan254 3 жыл бұрын
I solved almost all of the string based sliding window questions using count of distinct numbers technique in one way or another... It's such an OP trick
@akankshasinha3352
@akankshasinha3352 2 жыл бұрын
Hi … please tell , how to build concept for rest of the linkedlist and trees kind of problem? Cz everything is not covered on this channel ! 🥺😔 gimme some ideas
@vishalgupta957
@vishalgupta957 2 жыл бұрын
@@akankshasinha3352 search tuf , striver has covered variety of problems on trees, first get a basic idea of how recursion works, then trees will be a cakewalk for you. Linkedlist are easy dude. it will come along with some practice.
@akankshasinha3352
@akankshasinha3352 2 жыл бұрын
@@vishalgupta957 thankyouuuuu 😋😋 i
@uavishal777
@uavishal777 2 жыл бұрын
I don't know why subscriber are less at this Channel...No one can Compare to Aditya Bhaiya...He is amazing to make people understood what he teach... Lots of love to your effort and your way of teaching.
@anamaysrivastava1219
@anamaysrivastava1219 3 жыл бұрын
Sir, please bring in new lectures on remaining topics . Your observations has really been a boon to all of us .
@anshulkumar7871
@anshulkumar7871 3 жыл бұрын
Start uploading again, please. We need you. Jaldi aao.
@prakhanshubharadwaj1545
@prakhanshubharadwaj1545 3 жыл бұрын
Please make a series on tree and graphs ... Please!
@swarbhatia
@swarbhatia 3 ай бұрын
This one was a bit trickier than the rest but managed to code it after a few attempts. Amazing playlist, I have personally seen a lot of question based on the limited patterns covered in this playlist! Very helpful!
@varshalisingh5835
@varshalisingh5835 3 жыл бұрын
Why have you stopped making videos?...Your content is just awesome.
@nagpuri4390
@nagpuri4390 Жыл бұрын
Bro can u pls help in the leetcode 1838 frequency of most frequent element question??? Using Aditya Sir approach
@raghavagrawal6263
@raghavagrawal6263 2 жыл бұрын
Tried implementing in Python.. def minimumSubstringWindow(strng, t): count_map = dict() n = len(strng) for ch in t: if ch in count_map: count_map[ch] += 1 else: count_map[ch] = 1 start = 0 end = 0 map_size = len(count_map) min_window_len = 1000000007 maxStart = 0 maxend = 0 while end < n: if strng[end] in count_map: count_map[strng[end]] -= 1 if count_map[strng[end]] == 0: map_size -= 1 while map_size == 0: min_window_len = min(min_window_len, (end - start + 1)) maxStart = start #substring start index maxend = end+1 #substring end index ch_start = strng[start] if ch_start in count_map: count_map[ch_start] += 1 if count_map[ch_start] > 0: map_size += 1 start += 1 end += 1 print("substring start index {} and end index {}".format(maxStart, maxend)) return min_window_len
@SUMITKUMAR-rt5bs
@SUMITKUMAR-rt5bs 3 жыл бұрын
working code in C++ According to Aditya Bhai's Explanation Hope this help!!!! #include using namespace std; int main() { string s="totmtaptat"; string s1="tta"; // Making the Map unordered_map mp; for(int i=0 ; i
@malkeetsapien4852
@malkeetsapien4852 2 жыл бұрын
Thanks Man !
@Amansingh-gi3gx
@Amansingh-gi3gx Жыл бұрын
,🔥🔥❤️
@satyajeetrajupali3147
@satyajeetrajupali3147 6 ай бұрын
int minWindowSubstring(string s, string t) { int i = 0; int j = 0; int ans = INT_MAX; int n = s.length(); unordered_map mp; int count = 0; for (char c : t) { if (mp.find(c) == mp.end()) mp[c] = 0; mp[c]++; } count = mp.size(); while (j < n) { if (mp.find(s[j]) != mp.end()) { mp[s[j]]--; if (!mp[s[j]]) count--; } if (count > 0) j++; else if (count == 0) { while (count == 0) { ans = min(ans, j - i + 1); if(mp.find(s[i]) != mp.end()){ mp[s[i]]++; if(mp[s[i]] == 1) count++; } i++; } j++; } } return ans; }
@willturner3440
@willturner3440 3 жыл бұрын
I was stucked in this problem for last 3 hrs but after watching your video I was able to code in single run 😃
@udityakumar9875
@udityakumar9875 Жыл бұрын
Thanks a lot for this awesome playlist . just completed and pretty much confident to solve most of the sliding window problems now
@nagpuri4390
@nagpuri4390 Жыл бұрын
Bro can u pls help in the leetcode 1838 frequency of most frequent element question??? Using Aditya Sir approach
@sarthaksoni7864
@sarthaksoni7864 3 жыл бұрын
Subscribed. Hands down best content on youtube. I recently stumbled upon a problem I couldn't solve. Take a look into this mate might even be an addition to the playlist. the question - Given a string s and an integer k, return the length of the longest substring of s such that the frequency of each character in this substring is greater than or equal to k. Input: s = "aaabb", k = 3 Output: 3 Explanation: The longest substring is "aaa", as 'a' is repeated 3 times. Input: s = "ababbc", k = 2 Output: 5 Explanation: The longest substring is "ababb", as 'a' is repeated 2 times and 'b' is repeated 3 times.
@payaljain4015
@payaljain4015 3 жыл бұрын
string minWindow(string s, string t) { int size=t.length(); int size1=s.length(); if(size>size1) return ""; string ANS = ""; mapm; for(int i = 0; i < size; i++){ m[t[i]]++; } int i=0,j=0,ans=INT_MAX; int count=m.size(); while(j
@kailashjangir1530
@kailashjangir1530 3 жыл бұрын
@@payaljain4015 string smallestWindow (string s, string p){ vector umap(128,0); for(int i=0;i 0){ counter++; } i++; } } return minLength == INT_MAX ? "-1" : s.substr(minStart,minLength); }
@akshitmittal1251
@akshitmittal1251 8 ай бұрын
Bhai tu best h Plss saare concepts pe video banado. I have enrolled in Coding blocks, Simplilearn and now HEYCOACH cohort fot DSA. Prr conecpts strong sirf teri videos se hote hai. Please saare concepts pe video banao bhai, IN THE SAME FORMAT PLease. Apna way of teaching and format constant rakhna bas. I always recomment you to everyone, who needs DSA!! U r best bro. Keep it up
@shashankkr1008
@shashankkr1008 3 жыл бұрын
Sir, never stop doing this, gold content
@abdussamad0348
@abdussamad0348 2 жыл бұрын
finally after so many tries of dry run. Here is the Js approach. function minimumWindowSubstring(s, k) { let [start, end, count, ans] = [0, 0, 0, Infinity]; let ansString = ""; const obj = {}; for (let i = 0; i < k.length; i++) { obj[k[i]] = (obj[k[i]] || 0) + 1; } count = Object.keys(obj).length; while (end < s.length) { if (count !== 0) { if (obj.hasOwnProperty(s[end])) { obj[s[end]]--; } if (obj[s[end]] === 0) { count--; } if (count !== 0) { end++; } } if (count === 0) { if (ans > Math.min(ans, end - start + 1)) { ans = Math.min(ans, end - start + 1); ansString = s.slice(start, end + 1); } if (obj.hasOwnProperty([s[start]])) { obj[s[start]]++; } if (obj[s[start]] == 1) { count++; end++; start++; continue; } start++; if (ans > Math.min(ans, end - start + 1)) { ans = Math.min(ans, end - start + 1); ansString = s.slice(start, end + 1); } } } return ans === Infinity ? "" : ansString; }
@piyushsaxena6243
@piyushsaxena6243 3 жыл бұрын
after watching this playlist, i finally can say that i can solve almost every problem of sliding window, really this is the best explanation for sliding window technique. Thanks a lot
@aryans_space
@aryans_space Жыл бұрын
A)Java soltuion for this video: as well as modified for leetcode in part B) public class minimum_window_substring { public static void main(String[] args) { String s = "timetopractice", t = "toc"; HashMap map=new HashMap(); for(int x=0;x
@nagpuri4390
@nagpuri4390 Жыл бұрын
Bro can u pls help in the leetcode 1838 frequency of most frequent element question??? Using Aditya Sir approach
@pratiksonawane1076
@pratiksonawane1076 2 жыл бұрын
Bhaiya aapki puri playlist dekhi. Best playlist on youtube for sliding window technique👌. Voting for backtracking series
@manavshah7450
@manavshah7450 3 жыл бұрын
Placement season has started. Please upload videos on graphs and backtracking. And possibly add more videos on DP. Thanks!
@akankshasinha3352
@akankshasinha3352 2 жыл бұрын
Hi … please tell , how to build concept for rest of the linkedlist and trees kind of problem? Cz everything is not covered on this channel ! 🥺😔 gimme some ideas
@AvikNayak_
@AvikNayak_ 2 жыл бұрын
@@akankshasinha3352 you can check out take U forward youtube channel.
@manavshah7450
@manavshah7450 2 жыл бұрын
@@akankshasinha3352 check out take u forward. And love babbars dsa cracker sheet.
@vineetjadhav1785
@vineetjadhav1785 4 ай бұрын
Here is the most easy to understand solution, I hereby conclude that I have completed this series and I am confident that I can identify and tackle the sliding window problems. Thanks Aditya Bhaiya ur teaching gave mine lost confidence back 🔥🔥❤❤ Code: class Solution { public: string minWindow(string s, string t) { unordered_map mp; for (char c : t) mp[c]++; int count = t.size(); int i = 0, j = 0; int ans = INT_MAX; int start = 0; while (j < s.size()) { if (mp[s[j]] > 0) count--; mp[s[j]]--; j++; while (count == 0) { if (j - i < ans) { ans = j - i; start = i; } mp[s[i]]++; if (mp[s[i]] > 0) count++; i++; } } if (ans == INT_MAX) return ""; return s.substr(start, ans); } };
@ewananmo2404
@ewananmo2404 3 жыл бұрын
This has been an awesome series. Thanks a lot! Please cover more topics!
@rafiqn2675
@rafiqn2675 3 жыл бұрын
Bhai kaha gaye the yaar... I just waited, waited and again I waited...
@siddhantsrivastava4048
@siddhantsrivastava4048 3 жыл бұрын
Aditya shocked to see your face on recommended video😮😮 Good Job! SSMV ka naam roshan kar diya👍
@sangamchoudhary6977
@sangamchoudhary6977 3 жыл бұрын
Here is the c++ implementation string minWindow(string s, string t) { int i=0,j=0,MinL=INT_MAX,start=0; unordered_map mp; for(auto it:t) mp[it]++; int count=mp.size(); if(mp.find(s[j])!=mp.end()){ mp[s[j]]--; if(mp[s[j]]==0) count--; } while(j0){ j++; if(mp.find(s[j])!=mp.end()){ mp[s[j]]--; if(mp[s[j]]==0) count--; } } else if(count==0){ // MinL=min(MinL,j-i+1); if(MinL>j-i+1){ MinL=j-i+1; start=i; } while(count==0){ if(mp.find(s[i])!=mp.end()){ mp[s[i]]++; if(mp[s[i]]==1){ count++; // MinL=min(MinL,j-i+1); if(MinL>j-i+1){ MinL=j-i+1; start=i; } } i++; } else i++; } } } string str=""; if(MinL!=INT_MAX) return str.append(s.substr(start,MinL)); else return str; } Runtime: 44 ms Memory Usage: 7.8 MB
@RishavRaj-kn8nm
@RishavRaj-kn8nm 3 жыл бұрын
Pretty Awesome code man.
@shreelbansal3026
@shreelbansal3026 3 жыл бұрын
Thank you!!
@kanishkraj5640
@kanishkraj5640 3 жыл бұрын
Why you have checked the first value before the while loop(j
@curiossoul
@curiossoul 3 жыл бұрын
@@kanishkraj5640 i guess coz he is incrementing j bfr use in while loop, either move it to end of if block or start j with -1 to avoid it
@akankshasinha3352
@akankshasinha3352 2 жыл бұрын
Hi … please tell , how to build concept for rest of the linkedlist and trees kind of problem? Cz everything is not covered on this channel ! 🥺😔 gimme some ideas
@prathikmishra977
@prathikmishra977 9 ай бұрын
completed the whole playlist sir thankyou for such an effort of yours to explain this topic in such depth.
@deepakgurjar3746
@deepakgurjar3746 2 жыл бұрын
Finally i Completed the whole playlists of the "appar gyan bhandar".......thanks thanks a lot*infinity Sir❤❤❤❤
@AmitSingh-nf2fz
@AmitSingh-nf2fz 3 жыл бұрын
Sir please make videos on Back-Tracking and Graph !!! It will be very helpful for us who cannot afford such quality and expensive courses on other plateform. Keep up the good work sir!!!😇
@freshcontent3729
@freshcontent3729 3 жыл бұрын
I'm also from MANIT CSE. Please please make a series on Trees and graphs. Much needed. Placement season is approaching.
@akankshasinha3352
@akankshasinha3352 2 жыл бұрын
Hi … please tell , how to build concept for rest of the linkedlist and trees kind of problem? Cz everything is not covered on this channel ! 🥺😔 gimme some ideas
@akshatmahajan2692
@akshatmahajan2692 2 жыл бұрын
@@akankshasinha3352 You can check other channels related to coding as Leadcode by fraz and pepcoding(they have great playlists regarding different problems)
@hrithikkumar9648
@hrithikkumar9648 2 жыл бұрын
@@akankshasinha3352 first of all see mycodeschool DSA playlist make notes then all playlist of Aditya Verma starting from heap, stacks, sliding window, binary search, recursion except dp .....and make sure to make notes of all these topics. Then watch striver recursion playlist and dp playlist and make notes . Then solve striver sde sheet of 180 question it might be difficult for uhh to solve every problems by own so try to see video solution.....nd I guarantee this is enough for anybody to get good placement nd for girls it is enough to get very good placement ☕☕🌚
@prathamrajbhattnit-allahab4108
@prathamrajbhattnit-allahab4108 Жыл бұрын
@@hrithikkumar9648 hello bro kya tmne insabka notes bna rkha hai proper?
@hrithikkumar9648
@hrithikkumar9648 Жыл бұрын
@@prathamrajbhattnit-allahab4108 haan Bhai notes h thik thak bane hue bass mei jada decorated nhi krta hu notes I mean only use one pen ...aur concept pakda aur code rough type se likh diya ache se samajh mei aa jayega kisiko v mere notes 👍
@sameerchoudhary8590
@sameerchoudhary8590 3 жыл бұрын
The most awaited video of the most amazing teacher.
@sameerchoudhary8590
@sameerchoudhary8590 3 жыл бұрын
Bas ab ek hi cheez bachi hai zindagi me aur wo hai aapke charan sparsh karna.
@TheAdityaVerma
@TheAdityaVerma 3 жыл бұрын
Arreyy Nhi bhai, hmara aashirvaad aese hi sath h tumhare 🖐😬😬
@sameerchoudhary8590
@sameerchoudhary8590 3 жыл бұрын
Thank you so much for all this hard work sir, coding has never been this easy.
@AyushSharma-ww6vd
@AyushSharma-ww6vd 3 жыл бұрын
Completely agree brother. I am so fortunate ki mujhe ye channel Mila.
@jayantsharma2669
@jayantsharma2669 3 жыл бұрын
I am following your DP playlist. I have seen comments of your every video, Everybody request you to make trees & graph tutorial. These topics are tougher to understand? If yes then I am also requesting you to make videos on them. Thanks
@tanmoymazumdar9354
@tanmoymazumdar9354 3 жыл бұрын
Sir what happened to you.Hope you are kepping well the last video was uploaded 4 months ago we really want your help many are eagerly waiting for your videos. Please come back soon.
@rajshreegupta4454
@rajshreegupta4454 3 жыл бұрын
Sir your way of teaching is really magical. Even hard questions of leetcode seem easy. This and upcoming generations are really blessed to have your lectures. Sir just a request please make graph also easy. You can make any topic a cakewalk.
@b_01_aditidonode43
@b_01_aditidonode43 10 ай бұрын
thanks sir!! you explained the sliding window concept in amazing depth , amazing playlist
@Rohangamin517
@Rohangamin517 9 ай бұрын
This playlist of sliding window is like God gifted for everyone😊😊😊
@surendharv795
@surendharv795 2 жыл бұрын
Sir , My friend requested ur channel. I am a non Hindhi speaker. But somewhat I can understand ur video....It will be more better if u add subtitiles....Autogenerating Subtitles are not good.Thank you for the great content .
@sarankumar165
@sarankumar165 2 жыл бұрын
*C++ Implementation* : string minWindow(string s, string t) { //declare window variables int i=0,j=0; int len=INT_MAX; //to store the length of minimum window int startIdx = 0; string result;//finally return s.substr(startIdx,len) //create freq. map unordered_map mp; for(int i=0 ; i
@akankshasinha3352
@akankshasinha3352 2 жыл бұрын
Hi … please tell , how to build concept for rest of the linkedlist and trees kind of problem? Cz everything is not covered on this channel ! 🥺😔 gimme some ideas
@azhar7472
@azhar7472 2 жыл бұрын
Nice
@misterdi7238
@misterdi7238 Жыл бұрын
thank you so much bhai ...
@sarvagyaiitmadras8727
@sarvagyaiitmadras8727 3 жыл бұрын
Thnx bro for not showing us the exact code but only explaining the logic , As, after doing the code without error after using with Video's logic, Is great feeling :)
@SUMITKUMAR-rt5bs
@SUMITKUMAR-rt5bs 3 жыл бұрын
Hey brother, can you provide your code?? My code is not working .
@TuringTested01
@TuringTested01 Жыл бұрын
doing MTECH in iit doesnt count so remove that iit madras from your profile name
@bruh-moment-21
@bruh-moment-21 Жыл бұрын
@@TuringTested01 It counts very well.
@satya_k
@satya_k 2 жыл бұрын
Thank you Aditya Verma, really thank you! I completed the whole sliding window algo series, and I'm able to solve almost any kind of problem related to sliding window. Great series indeed. For those of you having difficulty writing the code for this, I wrote one to help you: //This function returns the smallest window(string) string smallestWindow (string s, string t) { // I really loved solving this problem - Love you Aditya Verma - You are a gem unordered_mapmap; unordered_mapans; //map to store the size and initial index of answer window for(auto x : t) map[x]++; int i = 0, j = 0, count = map.size(), minsize = INT_MAX, n = s.size(); bool flag = true; while(j
@debbh274
@debbh274 2 жыл бұрын
Very nice video. Clarity of your thought process is awesome.
@cherish689
@cherish689 3 жыл бұрын
Please continue uploading videos seriously u teach very well and it is very much understandable
@rishabhgupta9846
@rishabhgupta9846 Жыл бұрын
After listening problem explanation able to solve by myself ,thank you for the series bhai
@parikshitsinghrathore6130
@parikshitsinghrathore6130 2 жыл бұрын
If you want to find the smallest string: string minWindow(string s, string t) { int starti=0; int endi=-1; int slen = s.length(); int tlen = t.length(); unordered_map mp; for(int i=0;i
@RohitKumar-cv7qb
@RohitKumar-cv7qb Жыл бұрын
stucked at an edge case in gfg
@vishalsethi4024
@vishalsethi4024 3 жыл бұрын
Great dedication "Likh hi deta hu"!!!
@ShubhamKumar-wj3fu
@ShubhamKumar-wj3fu 3 жыл бұрын
Sir please complete the DP series. There is no content comparable to yours.
@googleit2490
@googleit2490 Жыл бұрын
Great Explanation :) Coded after watching the video with a wrong attempt... Sep'27, 2023 11:10 pm
@gyan2664
@gyan2664 2 жыл бұрын
I am glad previous approach provided help me to solve this problem , without looking at this videos
@amansinghgautam9189
@amansinghgautam9189 3 жыл бұрын
Bhiya poora graph aur tree pe daalo videos plz. Btw aapka dp seris bhut mast tha😊😊😊😊😊. Bhiya dp ka playlist mein kuch missing h kyaa?? Yaa complete h woh?
@abhinavshukla6418
@abhinavshukla6418 3 жыл бұрын
misiing he
@ruchitachandel2348
@ruchitachandel2348 2 жыл бұрын
Your videos are so amazing. Please make a playlist of system design. we don't see any good system design videos especially in hindi.
@kms8320
@kms8320 3 жыл бұрын
Sir please make a dedicated series on backtracking, it is really needed.
@ayush4565
@ayush4565 2 жыл бұрын
SIR, Ye toh Gold hai👏👏👏👏
@ShivaM-wg9qc
@ShivaM-wg9qc 4 ай бұрын
C++ Code for the explanation and also made the addition for LC Question as it needs us to return the actual substring : my solution is not the most optimal but this is what i came up with based on my current understanding. string minSubstrWindow(string s, string t) { if(t.length()>s.length()) { return ""; } int res = INT_MAX; // we calc the freq of each char in the map unordered_map map; unordered_map mapS; for(int i=0; i
@ShivaM-wg9qc
@ShivaM-wg9qc 4 ай бұрын
idea behind returning string as out answer : we use an ans variable since we know we are trying to find the smallest substring we can use that to our advantage and use the minimum window size. So whenever after changing the count to 1 we check if our stored ans length is > then the window if yes than store the string in the window as our answer
@brownwolf05
@brownwolf05 3 жыл бұрын
Please make playlist for backtracking and queue ds
@vinitverma1741
@vinitverma1741 9 ай бұрын
Very Very good explanation
@clash-of-coding
@clash-of-coding Жыл бұрын
Hello sir, you are the best teacher, what is next series.....I want sorting series.
@deepakbhallavi1612
@deepakbhallavi1612 Жыл бұрын
Thank you so much bhaiya ❤️ Now I am able to solve LeetCode medium problems based on sliding window 💯✅
@amanpreetsinghsetia1524
@amanpreetsinghsetia1524 3 жыл бұрын
God of Dp is back🙌🏻🤩
@funnyhilarious123
@funnyhilarious123 Ай бұрын
solved by my own, thank you for the concepts
@ashwanisingh8354
@ashwanisingh8354 Жыл бұрын
C++ solution along with explanation to few condition I have taken into account string minWindow(string s, string t) { // base case if length of s in smaller than j if(s.size() < t.size()) return ""; // initialize the map to store character ocurring in t along with their count unordered_map map; for (char c : t) map[c]++; // define i and j and n = s.size() along with count int i = 0; int j = 0; int count = map.size(); int n = s.size(); int minSize = INT_MAX; //I am using pair to store the index of smallest resultant substring pair res{-1,-1}; while( j < n){ if(map.find(s[j]) != map.end()){ map[s[j]]--; if(map[s[j]] == 0)count--; } cout
@manojg4451
@manojg4451 3 жыл бұрын
Hi Aditya ,Please make more videos
@MukulBansal076
@MukulBansal076 3 жыл бұрын
Sir please make a playlist on backtracking!!
@chrisogonas
@chrisogonas 9 ай бұрын
Very well illustrated! Thanks
@mohit6215
@mohit6215 Жыл бұрын
Aditya verma: "It's show time 😊"
@anirudhkumarchaudhary5681
@anirudhkumarchaudhary5681 3 жыл бұрын
Bhaiya graph ki series bhi upload kr do please 🙏
@NishantKumar-hu7dq
@NishantKumar-hu7dq 3 жыл бұрын
Bhaiya youtube channel ka password bhul gye h kya??
@devsatendrasingh9090
@devsatendrasingh9090 2 жыл бұрын
// Idea behind iterating Given String length can thought as : // 1) Iterate thru string S till the count [map size from String T characters] variable reaches to 0. // 2) Once counter is 0, try to move the start(i) pointer towards end(0) pointer to minimize the length of the found substring. If character at start pointer matches with string T increment the count variable. Loop thru till count variable is 0. // if(s == null || s.length() < t.length() || s.length() == 0){ // return ""; // } int i=0; int j=0; String ans=""; int minSizeOfSubstring=Integer.MAX_VALUE; HashMapmap=new HashMap(); for(int m=0;m0 char chI=s.charAt(i); if(!map.containsKey(chI)){ i++; } else { map.put(chI,map.get(chI)+1); if(map.get(chI)>0){ count++; } i++; } // OTMTA or TMTA me compare karna hai if(count==0){ if(minSizeOfSubstring>j-i+1){ ans=s.substring(i,j+1); minSizeOfSubstring=j-i+1; } } } } j++; } return ans;
@yadavprakesh003
@yadavprakesh003 3 жыл бұрын
Sir please make a graph series
@sushilsingh9632
@sushilsingh9632 2 жыл бұрын
Bhaiya other data structure and Algorithm me bhi videos bnaiye plz😌... The way you explain the approach of problems can't be found anywhere else🥰.
@JitendraKumar-ti6yd
@JitendraKumar-ti6yd 2 жыл бұрын
Thanks Aaditya bhai!! Completed DP and SLiding window playlist! Can you please upload video related to Backtracking and greedy algo
@shreyaskumarsharma5908
@shreyaskumarsharma5908 2 жыл бұрын
I think this code works in case when length of the minimum substring is to be returned : - int Solution(string s, string p) { int n = s.length(); int m = p.length(); int i = 0, j = 0; int Count = INT_MAX; int l = INT_MAX; unordered_map freq; for (int i = 0; i < m; i++) freq[p[i]]++; Count = freq.size(); if (m < n) { while (j < n) { if (freq.find(s[j]) != freq.end()) { freq[s[j]]--; if (freq[s[j]] == 0) Count--; } if (Count > 0) j++; if (Count == 0) { l = min(l, j - i + 1); while (Count == 0 && i
@tanishkumar6682
@tanishkumar6682 Жыл бұрын
This code is giving TLE in GFG
@sololearner7557
@sololearner7557 3 жыл бұрын
Bhaiya jaise aapne DP easy kr di... please Backtracking ko bhi easy kr do🥺🙏🙏🙏🙏🙏
@rahulsawhney1279
@rahulsawhney1279 3 жыл бұрын
Sir please make a series on Trees and Graphs.
@dhondipranav3721
@dhondipranav3721 3 жыл бұрын
Sir please start greedy Algo too
@ankoor
@ankoor 3 жыл бұрын
In this video condition is explained but "what to compare the condition to?" is not well explained, I tried "if count > 0: j++" and "else if count == 0: ...result and slide window". I then tried another approach. Below is the Python3 code for another approach: S = list("ADOBECODEBANC") T = list("ABC") freqT = {} for c in T: freqT[c] = freqT.get(c, 0) + 1 i = 0 j = 0 m = len(S) n = len(T) freqS = {} output = [] matchCount = 0 while i < m: # Acquire while i < m and matchCount < n: c = S[i] freqS[c] = freqS.get(c, 0) + 1 if freqS.get(c, 0)
@darshankubavat1764
@darshankubavat1764 3 жыл бұрын
Bro please can you make a playlist for the Greedy algorithm, there are not many playlists for greedy and if you teach us then it would be great for us.
@codetochange8
@codetochange8 2 жыл бұрын
Sliding Window Completed 💯..Thank You Aditya Bhaiya 🙏🙏...
@parvahuja7618
@parvahuja7618 Жыл бұрын
thankyou bhai saari video dekhi maza aaya
@kanhav03
@kanhav03 3 жыл бұрын
I think it will also consider "CTO" as a minimum string when we are given "TOC" Because of the map that we used
@HimanshuSharma-cm8hi
@HimanshuSharma-cm8hi 2 жыл бұрын
@MineCognito striver
@alienx2367
@alienx2367 3 жыл бұрын
Are Verma Ji Underground Chale Gaye kya app
@tanaysingh5348
@tanaysingh5348 Жыл бұрын
can't thank you enough, had fun sliding through the playlist
@itz_me_imraan02
@itz_me_imraan02 3 жыл бұрын
Your videos are too good.... Plz cover topics like segement trees, graphs, backtracking
@no-body7286
@no-body7286 3 жыл бұрын
sir please continue this series , if you want we can rise fund for you ! in crowd funding
@suyashshukla6657
@suyashshukla6657 2 жыл бұрын
flipkart mein hai vo , fund raise karega
@preetambal7443
@preetambal7443 3 жыл бұрын
loved this video..will share your videos with all my friends..Top work..keep it up!
@pranjalgupta9427
@pranjalgupta9427 3 жыл бұрын
Bhai ittne din baad.. Kaha chale gaye thee bhai?? Aapka video ka hum kabse wait kar rahe thee 😀😀
@Realमहात्मागांधी
@Realमहात्मागांधी 3 жыл бұрын
As much u find time make more video for ours it reqst 2u please🙏
@TheAdityaVerma
@TheAdityaVerma 3 жыл бұрын
Yaar job k sath manage krna thoda mushkil ho jata hai :( I hope you guys understand.
@rafiqn2675
@rafiqn2675 3 жыл бұрын
@@TheAdityaVerma per bhai... Ab se thoda regularly upload karo please A placement time hai tho... Bahut help hogi... Hamari
@prateekvarshney2280
@prateekvarshney2280 3 жыл бұрын
@@TheAdityaVerma bhai trees and graphs start karoo 🙏🙏
@SarthakKumar
@SarthakKumar 2 жыл бұрын
New videos ka wait kab khatam hoga sir!!!! Biggest Suspense of all time for us😅
@chaynnittagarwal3215
@chaynnittagarwal3215 2 ай бұрын
wonderful explaination 🫡
What type of pedestrian are you?😄 #tiktok #elsarca
00:28
Elsa Arca
Рет қаралды 27 МЛН
Hoodie gets wicked makeover! 😲
00:47
Justin Flom
Рет қаралды 127 МЛН
ТЮРЕМЩИК В БОКСЕ! #shorts
00:58
HARD_MMA
Рет қаралды 2,3 МЛН
Миллионер | 3 - серия
36:09
Million Show
Рет қаралды 1,6 МЛН
What type of pedestrian are you?😄 #tiktok #elsarca
00:28
Elsa Arca
Рет қаралды 27 МЛН