Minimum Window Substring | Variable Size Sliding Window

Поделиться
HTML-код
  • Опубликовано: 26 окт 2024

Комментарии • 732

  • @rohitlandge3890
    @rohitlandge3890 3 года назад +93

    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

  • @TheAdityaVerma
    @TheAdityaVerma  3 года назад +343

    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 года назад +16

      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 года назад +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 года назад +5

      Bhai you are great your videos are very helpful, plz make videos on backtracking plz🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏

    • @rv0_0
      @rv0_0 3 года назад +4

      upload nhi kiye

    • @rubinip1956
      @rubinip1956 3 года назад +2

      Kindly add subtitles..so it Will be useful for everyone

  • @haritmohan1326
    @haritmohan1326 3 года назад +147

    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 года назад +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 года назад +10

      Keep waiting 😂😂😂

    • @ytg6663
      @ytg6663 2 года назад +1

      @@akankshasinha3352 u may refer to other channel take u forward / striver / techdose

    • @VinayKumar-ze2ww
      @VinayKumar-ze2ww 2 года назад +1

      @iblis take u forward

  • @mayank6023
    @mayank6023 3 года назад +1059

    Vote for backtracking series.

  • @rithikraj1813
    @rithikraj1813 3 года назад +6

    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 ❤️❤️

  • @mrugeshsabalpara6755
    @mrugeshsabalpara6755 3 года назад +46

    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 года назад +4

      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++;
      }

  • @Abc-lr4bf
    @Abc-lr4bf Год назад +2

    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

  • @shashwatrai1989
    @shashwatrai1989 3 года назад +16

    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.

  • @JangBahadur3028
    @JangBahadur3028 3 года назад +13

    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.

  • @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!

  • @itsrahimuddinkhan
    @itsrahimuddinkhan 3 года назад +27

    Please start a series on trees and graphs.

  • @sohamnandi4708
    @sohamnandi4708 3 года назад +22

    Please make a Series on Backtracking, Graph, Tree, Hashing & Number System

  • @ritikshandilya7075
    @ritikshandilya7075 6 месяцев назад +3

    Aditya bhai , sari playlist ka security tight krva lo . Its PURE GOLD 🔥. Thanks for great approach

  • @udityakumar9875
    @udityakumar9875 Год назад +4

    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

  • @krishgarg5665
    @krishgarg5665 2 года назад +37

    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 Год назад +5

      already covered by striver

    • @NewBIE-xz5jm
      @NewBIE-xz5jm 8 месяцев назад

      Then why are you here! lol
      @@vivekswami2182

  • @ewananmo2404
    @ewananmo2404 3 года назад +9

    This has been an awesome series. Thanks a lot! Please cover more topics!

  • @prakhanshubharadwaj1545
    @prakhanshubharadwaj1545 3 года назад +16

    Please make a series on tree and graphs ... Please!

  • @abdussamad0348
    @abdussamad0348 2 года назад +1

    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;
    }

  • @manavshah7450
    @manavshah7450 3 года назад +12

    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.

  • @sarthaksoni7864
    @sarthaksoni7864 3 года назад +2

    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);
      }

  • @SUMITKUMAR-rt5bs
    @SUMITKUMAR-rt5bs 2 года назад +78

    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 года назад +2

      Thanks Man !

    • @Amansingh-gi3gx
      @Amansingh-gi3gx Год назад

      ,🔥🔥❤️

    • @satyajeetrajupali3147
      @satyajeetrajupali3147 5 месяцев назад +1

      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;
      }

  • @divyranjan254
    @divyranjan254 3 года назад +14

    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 года назад +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

  • @shashankkr1008
    @shashankkr1008 3 года назад +6

    Sir, never stop doing this, gold content

  • @varshalisingh5835
    @varshalisingh5835 3 года назад +11

    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

  • @anshulkumar7871
    @anshulkumar7871 3 года назад +14

    Start uploading again, please. We need you. Jaldi aao.

  • @anamaysrivastava1219
    @anamaysrivastava1219 3 года назад +9

    Sir, please bring in new lectures on remaining topics . Your observations has really been a boon to all of us .

  • @uavishal777
    @uavishal777 2 года назад +4

    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.

  • @prathikmishra977
    @prathikmishra977 8 месяцев назад

    completed the whole playlist sir thankyou for such an effort of yours to explain this topic in such depth.

  • @pratiksonawane1076
    @pratiksonawane1076 2 года назад +1

    Bhaiya aapki puri playlist dekhi. Best playlist on youtube for sliding window technique👌. Voting for backtracking series

  • @b_01_aditidonode43
    @b_01_aditidonode43 9 месяцев назад

    thanks sir!! you explained the sliding window concept in amazing depth , amazing playlist

  • @funnyhilarious123
    @funnyhilarious123 22 дня назад

    solved by my own, thank you for the concepts

  • @sameerchoudhary8590
    @sameerchoudhary8590 3 года назад +19

    The most awaited video of the most amazing teacher.

    • @sameerchoudhary8590
      @sameerchoudhary8590 3 года назад +5

      Bas ab ek hi cheez bachi hai zindagi me aur wo hai aapke charan sparsh karna.

    • @TheAdityaVerma
      @TheAdityaVerma  3 года назад +26

      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 года назад +2

      Completely agree brother. I am so fortunate ki mujhe ye channel Mila.

  • @chrisogonas
    @chrisogonas 8 месяцев назад

    Very well illustrated! Thanks

  • @willturner3440
    @willturner3440 3 года назад +3

    I was stucked in this problem for last 3 hrs but after watching your video I was able to code in single run 😃

  • @akshitmittal1251
    @akshitmittal1251 7 месяцев назад +1

    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

  • @raghavagrawal6263
    @raghavagrawal6263 2 года назад +9

    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

  • @rupalitiwari5012
    @rupalitiwari5012 2 года назад +4

    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 6 месяцев назад

      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;
      }
      }

  • @aryans_space
    @aryans_space Год назад +5

    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

  • @siddhantsrivastava4048
    @siddhantsrivastava4048 3 года назад +10

    Aditya shocked to see your face on recommended video😮😮
    Good Job!
    SSMV ka naam roshan kar diya👍

  • @sangamchoudhary6977
    @sangamchoudhary6977 3 года назад +40

    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 года назад +1

      Pretty Awesome code man.

    • @shreelbansal3026
      @shreelbansal3026 3 года назад +1

      Thank you!!

    • @kanishkraj5640
      @kanishkraj5640 3 года назад +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 года назад +1

      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

  • @rafiqn2675
    @rafiqn2675 3 года назад +6

    Bhai kaha gaye the yaar... I just waited, waited and again I waited...

  • @piyushsaxena6243
    @piyushsaxena6243 3 года назад +1

    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

  • @tanaysingh5348
    @tanaysingh5348 Год назад

    can't thank you enough, had fun sliding through the playlist

  • @debbh274
    @debbh274 2 года назад +2

    Very nice video. Clarity of your thought process is awesome.

  • @ShivaM-wg9qc
    @ShivaM-wg9qc 3 месяца назад

    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 3 месяца назад

      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

  • @gyan2664
    @gyan2664 2 года назад

    I am glad previous approach provided help me to solve this problem , without looking at this videos

  • @freshcontent3729
    @freshcontent3729 3 года назад +30

    I'm also from MANIT CSE. Please please make a series on Trees and graphs. Much needed. Placement season is approaching.

    • @akankshasinha3352
      @akankshasinha3352 2 года назад +1

      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 года назад +1

      @@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 года назад +1

      @@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 Год назад +2

      @@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 👍

  • @tanmoymazumdar9354
    @tanmoymazumdar9354 3 года назад +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.

  • @yeshwanthln7621
    @yeshwanthln7621 8 месяцев назад

    bro, really nice explanation...!! found it very useful.

  • @chaynnittagarwal3215
    @chaynnittagarwal3215 2 месяца назад

    wonderful explaination 🫡

  • @vinitverma1741
    @vinitverma1741 8 месяцев назад +1

    Very Very good explanation

  • @vineetjadhav1785
    @vineetjadhav1785 3 месяца назад

    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);
    }
    };

  • @komaljayswal5070
    @komaljayswal5070 5 месяцев назад +1

    Thank you

  • @cherish689
    @cherish689 3 года назад +1

    Please continue uploading videos seriously u teach very well and it is very much understandable

  • @Rohangamin517
    @Rohangamin517 8 месяцев назад

    This playlist of sliding window is like God gifted for everyone😊😊😊

  • @googleit2490
    @googleit2490 Год назад

    Great Explanation :)
    Coded after watching the video with a wrong attempt...
    Sep'27, 2023 11:10 pm

  • @priyanshkumar17
    @priyanshkumar17 11 месяцев назад

    Epic Level Explanation...Thanks !!

  • @rishabhgupta9846
    @rishabhgupta9846 Год назад +1

    After listening problem explanation able to solve by myself ,thank you for the series bhai

  • @AmolGarje-gs2mc
    @AmolGarje-gs2mc 5 месяцев назад

    Thanks sir for this best or more useful playlist ❤❤❤

  • @parvahuja7618
    @parvahuja7618 Год назад

    thankyou bhai saari video dekhi maza aaya

  • @ashwanisingh8354
    @ashwanisingh8354 11 месяцев назад

    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

  • @deekshithds3295
    @deekshithds3295 Год назад +1

    22:49 for the actuall solution and explaination

  • @parikshitsinghrathore6130
    @parikshitsinghrathore6130 2 года назад +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

  • @anupamtiwary4265
    @anupamtiwary4265 Год назад

    Thank you.
    This helped a lot.

  • @exit-bag
    @exit-bag 2 года назад +1

    can you please do video on bitmask dp & dp on grid

  • @AmitSingh-nf2fz
    @AmitSingh-nf2fz 3 года назад +4

    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!!!😇

  • @jayantsharma2669
    @jayantsharma2669 3 года назад +8

    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

  • @ayush4565
    @ayush4565 2 года назад

    SIR, Ye toh Gold hai👏👏👏👏

  • @sarankumar165
    @sarankumar165 2 года назад +21

    *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 года назад +1

      Nice

    • @misterdi7238
      @misterdi7238 Год назад

      thank you so much bhai ...

  • @RaviRavi-kt9gt
    @RaviRavi-kt9gt 9 месяцев назад

    Thank you so much sir ,just loved the series

  • @deepakgurjar3746
    @deepakgurjar3746 2 года назад

    Finally i Completed the whole playlists of the "appar gyan bhandar".......thanks thanks a lot*infinity Sir❤❤❤❤

  • @malkeetsapien4852
    @malkeetsapien4852 2 года назад +1

    Thank You !

  • @brownwolf05
    @brownwolf05 3 года назад +3

    Please make playlist for backtracking and queue ds

  • @vishalsethi4024
    @vishalsethi4024 3 года назад

    Great dedication "Likh hi deta hu"!!!

  • @helloimjavauser
    @helloimjavauser 10 месяцев назад

    wonderful explanation!!!!!!!!!!!!!!!

  • @sarvagyaiitmadras8727
    @sarvagyaiitmadras8727 3 года назад +4

    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 2 года назад

      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.

  • @preetambal7443
    @preetambal7443 3 года назад +1

    loved this video..will share your videos with all my friends..Top work..keep it up!

  • @amansinghgautam9189
    @amansinghgautam9189 3 года назад +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?

  • @surendharv795
    @surendharv795 2 года назад +1

    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 .

  • @vakhariyajay2224
    @vakhariyajay2224 Год назад

    Thank you very much. You are a genius.

  • @dineshkm7832
    @dineshkm7832 Месяц назад

    You are great man

  • @anirudhkumarchaudhary5681
    @anirudhkumarchaudhary5681 2 года назад +1

    Bhaiya graph ki series bhi upload kr do please 🙏

  • @kms8320
    @kms8320 3 года назад +5

    Sir please make a dedicated series on backtracking, it is really needed.

  • @venkateshjamge3471
    @venkateshjamge3471 2 года назад +2

    Want the Solutions for the playlist,
    Here you go:
    github.com/venkateshjamge/Sliding-Window-Algorithm-Aditya-Verma

  • @tanishqdawar5545
    @tanishqdawar5545 9 месяцев назад

    thanks for this series

  • @sahilanand30
    @sahilanand30 2 года назад +1

    Best explanation

  • @nidhiranjan6789
    @nidhiranjan6789 2 года назад

    No word to say thanks to you... Thanx

  • @gajendersharma417
    @gajendersharma417 2 года назад +1

    best lecture ever... loved it...

  • @dhondipranav3721
    @dhondipranav3721 3 года назад +2

    Sir please start greedy Algo too

  • @manojg4451
    @manojg4451 3 года назад +1

    Hi Aditya ,Please make more videos

  • @LokeshSharma-hm5jz
    @LokeshSharma-hm5jz Год назад

    NEVER THOUGHT OF DOING SUCH QUESTION BY MY OWN . THANKS FOR THE CONCEPT

    • @nagpuri4390
      @nagpuri4390 Год назад

      Bro can u pls help in the leetcode 1838 frequency of most frequent element question???
      Using Aditya Sir approach

  • @studyonline3236
    @studyonline3236 Год назад

    Thanks so much, Aditya, for creating such videos.

  • @jayeshparmar2603
    @jayeshparmar2603 Год назад

    Very very helpful thanks alot❤

  • @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)

  • @deepakbhallavi1612
    @deepakbhallavi1612 Год назад +2

    Thank you so much bhaiya ❤️
    Now I am able to solve LeetCode medium problems based on sliding window 💯✅

  • @ruchitachandel2348
    @ruchitachandel2348 2 года назад +1

    Your videos are so amazing. Please make a playlist of system design. we don't see any good system design videos especially in hindi.

  • @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

  • @shahzaib3469
    @shahzaib3469 2 дня назад

    amazing content

  • @rajshreegupta4454
    @rajshreegupta4454 3 года назад +1

    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.

  • @ShubhamKumar-wj3fu
    @ShubhamKumar-wj3fu 3 года назад +6

    Sir please complete the DP series. There is no content comparable to yours.