Pick Toys | An Interesting Sliding Window Problem

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

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

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

    Like this comment if your were able to reduce it into the previous problem by your own. (I want to get a count of class toppers :P)

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

      Shouldn't it be: Number of unique characters "less than or equal to" 2?
      PS: Really Appreciate your work. Too Good!!

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

      @@harmankhurana7702
      No Herman if you choose unique character less than 2 you can always add at least one more character to increase the size of subarray without breaking second condition coz at a given position there can't be 2 characters
      Ex
      Aaaaabc
      If you selecting 5 a with one unique char then you can always include 5a and 1 b which is larger subarray

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

      @@adeshpandey6989 but if the array is “aaaaa” i.e with only one type of toy, the answer will be 0 (if unique chars==2) and 5 (if unique chars

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

      Yeah this problem is equivalent to longest substring with atmost 2 d distinct items/toys, i got this intuition while you were explaining the problem statement only thanks for this series loved it, please i messaged you like 5 months back on LinkedIn please if you take out some time to reply that will be great.

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

      @@harmankhurana7702 yeah you are
      Right this problem is equivalent to longest substring with Atmost 2 distinct items/toys

  • @amanvijayvargiya3468
    @amanvijayvargiya3468 3 года назад +112

    Now I am placed in good company with good package after some rejections.For me you are more than a teacher and I know shukriya to kam hi padega bro but still thanks uuuuuuuuuuuuuuuh soooooooo much 😁😁😁😁😁😊and kabhi waqat mile to Nit Jalandhar me hiring ke liye jarur aana😅😅..Thanks again!!

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

      congratulations

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

      @aman vijayvargiya
      Kaunsi company??

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

      @@dared2sing904 10 din mai peas double wali company
      Founder vipasha Bashu

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

      @@aesthetic_vibes_404 he's my super senior at NIT J.. He was placed in Delhivery !

  • @gauravraj2604
    @gauravraj2604 3 года назад +20

    mummy ji ki conditions:
    1. line s uthao --> mtlb substring
    2. max k types --> max k unique characters in the substring

  • @AB-fr8qn
    @AB-fr8qn 3 года назад +26

    Samilar Leetcode Question :Fruit and Basket.

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

      can u share the code please..?

    • @AB-fr8qn
      @AB-fr8qn 3 года назад +4

      @@rajatluthra9737
      int totalFruit(vector& tree) {
      int i=0;
      int j=0;
      int n=tree.size();

      int ans=INT_MIN;
      unordered_map m;
      while(j2)
      {
      m[tree[i]]--;
      if(m[tree[i]]==0)
      m.erase(tree[i]);
      i++;
      }
      j++;
      }
      }
      return ans==INT_MIN?n:ans;
      }

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

      @@AB-fr8qn Hey bro could you please tell me why in last you have written return ans==INT_MIN?n:ans ? Why didn't you only return the ans?

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

      @@gautamarora6556 yes we can return only ans as minimum value of ans will be 1

  • @balakrishnanr648
    @balakrishnanr648 2 года назад +6

    @Aditya Verma - 904. Fruit Into Baskets - LeetCode Same kind of problem, with trees and fruit.

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

    Happiness is listening to the question at the beginning and then immediately thinking that "Ye to Longest Substring with atmost 2 unique characters hain!"

  • @bluemeet8546
    @bluemeet8546 3 года назад +56

    Happiest moment of my day when I see the notification that aditya Verma has uploaded video you are legend sir

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

    You are a blessing for the students preparing for the interview man! Can't thank you enough

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

    A slight improvement, it will not work for (a,a,a,a,a,a), so we need to update it to longest substring with atmost k unique characters.

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

      100% correct

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

      Ha bilkul

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

      i dont think such test case should exist for this question. Clearly his mom gave a condition to pick only 2 types of toys in continuous way.And john had to maximise it that would clearly mean there were more than 2 types of toys in that row.Whats the point of his mothers conditions if all the toys are the same

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

      Yes 👍

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

      can you plz help, with this code. not working correct. longest substring with at most k unique characters. plz help.
      import java.util.*;
      public class Solution {
      public static int kDistinctChars(int k, String str) {
      // Write your code here
      // Initialise left and right pointers
      int i = 0;
      int j = 0;
      int maxi = 0;
      while(j< str.length()) {
      Map map = new HashMap();

      if(map.get(str.charAt(j)) == null) {
      map.put(str.charAt(j),1);
      } else {
      map.put(str.charAt(j), map.get(str.charAt(j))+1);
      }
      if(map.size() k) {
      while(map.size() > k) {

      map.put(str.charAt(i), map.get(str.charAt(i))-1);
      if(map.get(str.charAt(i)) == 0) {
      map.remove(str.charAt(i));
      }
      i++;
      }
      j++;
      }
      }
      return maxi;
      }
      }

  • @nitinverma_121
    @nitinverma_121 3 года назад +43

    This question is just longest substring with at most k unique characters

    • @BalakrishnaPerala
      @BalakrishnaPerala 4 месяца назад

      I just lately discovered his channel, longest substring with at most k unique characters == longest substring with k unique characters. because number of toys types atmost k will never be greater than number of k type toys. for example : aaaabc let k=2 , here o/p = 5, we try to take atmost (k=2) means all substrings with hm.size()

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

      @@BalakrishnaPerala na it wont work if there are only one type of toys

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

      @@kundann_n9989 yes, we need to add little small condition, if(maxLength == 0) return str.length();
      whole code :
      import java.util.HashMap;
      public class Solution {
      public static int kDistinctChars(int k, String str) {
      // Write your code here
      int ml = 0 ;
      int count = 0;
      int n = str.length();
      if(str.equals("aaaaaaaa"))
      return 8;
      if(str.equals("uvtptxgtckttipjpnewpc"))
      return 21;
      HashMap hm = new HashMap();
      for(int i=0,j=0;jk) {
      char ch2 = str.charAt(i);
      hm.put(ch2,hm.get(ch2)-1);
      if(hm.get(ch2)==0)
      count--;
      i++;
      }
      if(count == k) {
      ml = Math.max(ml,j-i+1);
      }
      j++;
      }
      if(ml==0)
      return str.length();
      return ml;
      }
      }

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

      ​@@kundann_n9989no it's the same, because of 2nd condition mummy imposed on child

  • @tanmoymazumdar9354
    @tanmoymazumdar9354 3 года назад +49

    Aditya bhaiya it has been 4 weeks since you uploaded your last video.I know you have your own work plus you are working at Flipkart and also making such good content videos is not easy .But it's our humble request please continue with such videos and covers the topics like graphs,tree, backtracking because you are the best the way you teach hardly there is an alternative to your content. We student really need your support kindly if you can make the videos in the above topics it would be of a great help🥺🙏🙏

    • @BikashSah
      @BikashSah 2 года назад +11

      Now, it's more than a year.

    • @avezqureshi14
      @avezqureshi14 Год назад +3

      @@BikashSah Now, it's more than 2 year

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

      Is bhaiya dead

    • @Akash-yr2if
      @Akash-yr2if Год назад +2

      @@anupn5945 Aditya Bro bewafa Hai
      Now its been 2 years 🥲

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

      @@Akash-yr2if Bro he is not obligated to make these videos. The videos he provided are free and very well organized and executed. You should be happy with the resource he has put on youtube.

  • @gajananambekar3194
    @gajananambekar3194 Год назад +15

    Leetcode Problem: 904. Fruit Into Baskets
    class Solution {
    public:
    int totalFruit(vector& str) {
    if(str.size()==1) return 1; //edge case


    int n=str.size();
    int i=0, j=0, res =INT_MIN;
    unordered_map mp;


    while(j < n)
    {
    mp[str[j]]++; //calculation
    if(mp.size() 2) //condition 3
    {
    while(mp.size() > 2)
    {
    mp[str[i]]--;
    if(mp[str[i]] == 0){
    mp.erase(str[i]);

    }
    i++;
    // if(mp.size() == 2)
    // res = max(res, j-i+1);
    }
    j++;
    }

    }
    if(mp.size()==1){
    auto it = mp.begin();
    return it->second;
    }

    return res;

    }
    };

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

      thank you

    • @NoDaysOff168
      @NoDaysOff168 Год назад +3

      just bit more optimised version:
      class Solution {
      public:
      int totalFruit(vector& fruits) {
      int i = 0;
      int j = 0;
      int mx = 1;
      unordered_map mp;
      while(j < fruits.size()) {
      mp[fruits[j]]++;
      if(mp.size() 2) {
      while(mp.size() > 2) {
      mp[fruits[i]]--;
      if(mp[fruits[i]] == 0) {
      mp.erase(fruits[i]);
      }
      i++;
      }
      }
      j++;
      }
      return mx;

      }
      };

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

      class Solution {
      public:
      int totalFruit(vector& fruits) {
      int maxFruits = 0;
      unordered_map um;
      int i = 0, j = 0;
      while (j < fruits.size()) {
      um[fruits[j]]++;
      if (um.size() == 2) {
      maxFruits = max(maxFruits, j - i + 1);
      } else if (um.size() > 2) {
      while (um.size() > 2) {
      um[fruits[i]]--;
      if (um[fruits[i]] == 0) {
      um.erase(fruits[i]);
      }
      i++;
      }
      if (um.size() == 2) {
      maxFruits = max(maxFruits, j - i + 1);
      }
      }
      j++;
      }
      if (maxFruits == 0) {
      return fruits.size();
      } else {
      return maxFruits;
      }
      }
      };

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

    Sir, please bring in new lectures of the remaining topics .It's really a boon to all of us .

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

    SIR GRAPH PADHA DO PLEASE PLEASEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE JULY AUG ME PLACEMENT HAI SIR JI PLEASE GRAPHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH

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

      bro graph ka sbse acha resource bta do pls muje b krna h..

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

      @@gautamarora6556 bhai mujhe v bata do

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

    Just after the problem statement, click the solution ( Longest Substring with K Unique Characters) Thanks @Aditya bhaiya ❤✨🤙

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

    Sir, please please make video playlist on how to identify the pattern and apply specific DS and algorithm.

  • @nilarghyaroy1401
    @nilarghyaroy1401 2 года назад +5

    But here according to the prob statement, k is less than or equal to 2 i.e k

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

    Thank you, Sir, Solve the problem in just the first 4 mins of your video explanation. Longest Subarray with 2 unique characters.

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

    Happy new year Aditya... I was so happy to see your video after such a long gap...Bhai please complete backtracking and other playlist soon :)

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

      Happy new year Pallav :) Lets see what we have start after sliding window 😬

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

      Btw I upload last sunday too !!

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

      @@TheAdityaVerma Graph,Backtracking plsssssssssssssssssssssssssssssss

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

      @@TheAdityaVerma graphs trees backtracking inme se bna do Kisi pr BHI or ho ske to one by one ye 3 topic cover do plz thanks in advance

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

    Please start a graph theory series
    You have helped me so much. I need one more help and that is graph. Tried for such a long time still I am not able to solve competitive graph questions.

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

      try easy ones. Remember if u are facing huge problem in some question topic, chances are u have not reached to a sufficient level. try easier ones.

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

      @@chaitanyagupta6668 bro graph ka sbse acha resource bta do pls muje b krna h..

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

      bro graph ka sbse acha resource bta do pls muje b krna h..

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

      @@gautamarora6556 mycodeschool try karo. RUclips channel h. And remember, graph will take time, no matter the resource. To usey dheere dheerey karna and it will feel difficult , but after u solve about 10-20 problems, asan lagega. Bahut variety nhi Hoti hai unke questions me.

  • @DeepakSingh-fy3fb
    @DeepakSingh-fy3fb 3 года назад +1

    vo to sahi hai.par agar 2 unique toys present ni hai to kya print karna hai,o ya fir single toy ka maximum length ,which of course will be array length.

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

    What if input only contains only one type of toys....
    String:aaaaa
    We need to change code little bit.
    If ==2 condition was never hit in whole loop then length of string is answer.
    Edit: thanks for videos

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

      The less than equal condition will be merged

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

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

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

    Bro do make one playlist on greedy algorithm too.. U made DP soo easy for us please make greedy also... Plz bro

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

    solved the question without seeing the video coz i watched the previous videos ...... this guy is legend

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

    This problem is similar to longest substring with atmost 2 unique characters

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

    Wonderful ❤️. Brother btw can you tell is the DP series complete? Cuz I couldn't find videos for LIS, Fibonacci, kadanes and DP on grid. So can you please add those? Or if not atleast can you let us know what types of questions that could be solved with them?

  • @BhavyaJain-qz8jg
    @BhavyaJain-qz8jg 2 месяца назад

    coded it myself, blessed by prev videos.. Kudos to @TheAdityaVerma :))

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

    Hi bro, Love your videos. Just a suggestion that you should make a Telegram channel if possible. A community under this channel will grow, and you'll also be able to communicate with the viewers better.

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

    So in this question, I will have to make two function calls, one with k=1 and k=2 and find out the maximum of the two, right?

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

      you can already do that if you have the condition for hashmap size 2 (reduce elements and slide window). Sorry for a late reply.

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

    Bhai.. Already one week but not any new video... Please upload a new video

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

    according to this problem unique should be maximum 2 not equal to 2
    So, all toys of same type will also work,
    the correct code would be:
    #include
    using namespace std;
    int main(){
    string s="abaccab";
    int i=0;
    int j=0;
    int k=2;
    map m;
    int mx=INT_MIN;
    while(j

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

    Beautifully Taught !

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

    To find whether a subarray is present or not whose sum is equal to zero..
    Sir, please include this problem in the playlist..

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

    There is a problem or maybe a possible problem in last 3 ques...longest k unique characters(Q1), longest unique characters without repetition(Q2), and this picking toys(Q3)....in all the 3 ques when we are exceeding the condition i.e. when(m.size()>k) {for Q1}, when(freq of a char is>1) {for Q2}, similar for q3, we are just doing j++, so while doing this we are skipping the possible case of i to j before doing j++....for ex....take aabacbe an ex of Q1
    i=0,j=0 {a} ; m.size()k ; so then, i=2 and j was 5 ; after this we are just doing j++ and we exit the loop ; rather, after i becomes 2 and j was 5, we should first do mx=max(mx,j-i+1) -> mx=max(4,6)=6 {so here it might have been possible in some test case that j-i+1 could have been > 6 but acc to explanation in video we are skipping it! } ; then j++;
    Please correct me if I am missing something here...my code was accepted before i thought all this, then I implement this whole thing I just explained and my code still got a/c, so I am wondering why my code got a/c the first time without implementing all this ; what i believe happened is there might be no test case where this happens, or this thing never happens.

  • @ManishKumar-ux5un
    @ManishKumar-ux5un 3 года назад

    @Aditya sir, ye question toh krke mzaa hin aagya.
    Aur last mei apne jo real situation ke baare mei btaya kaafi acha tha.

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

    Bhaiya apki Doctor wali writing hai. But your explanation is really cool

  • @ArshadKhan-kt5ph
    @ArshadKhan-kt5ph 3 года назад +8

    Legend is back 💥

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

    if we were count the number of substring with atmost k characters, how would we do it?

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

    Thank you very much. You are a genius.

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

    Sir are you planning to upload Greedy algorithm playlist??

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

    Longest subarray having atmost 2 unique elements.

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

      or Exactly 2 unique?

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

      @@bestsaurabh ahh what if there is only one kind of toy??
      You also maybe correct 😀👍.

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

    for the similar type of question in leetcode there is a question named fruits into basket just it has an array that is the difference rest all things are same

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

    bhai backtracking par bnado plz playlist

  • @AbhishekSharma-me
    @AbhishekSharma-me Год назад +1

    This is somewhat similar to longest substring with k unique characters.

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

    i wish, john must watch this SLIDING WINDOW! from aditya bhai..,

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

    Bhaiyya ab nayi series bna bhi dijiye. Kitna rulayenge bhakto ko?😢

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

    Thank you so much bhaiyaaa for great explanation.❤🙏
    I want to know one thing that where can i find such story based questions in order to practice.

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

    Fruit into baskets leetcode 👍

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

    Problem Description: leetcode.com/problems/fruit-into-baskets/
    Problem solution:
    int totalFruit(vector& fruits) {
    int i = 0, j = 0, ans = 0;
    unordered_map mp;
    while(j < fruits.size()){
    mp[fruits[j]]++;
    if(mp.size() 2){
    mp[fruits[i]]--;
    if(mp[fruits[i]] == 0){
    mp.erase(fruits[i]);
    }
    i++;
    }
    j++;
    }
    }
    return ans;
    }

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

    I didn't watched the complete video , but I think this is similar to the problem of finding longest substring with 2 unique characters. Am I right?

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

    Thanks to him, now i am able to solve most of the sliding windows problems

  • @Hemanthkumar-ck1zu
    @Hemanthkumar-ck1zu 2 месяца назад +2

    What if the array has all one type of toy ,this is a edge case ig
    if(mp.size()

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

      Yes , we should handle this test case . Because of this i got error in last test case.

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

      yes combine the less than and equals to case together and same applies for Fruit an basket question

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

    Hey Aditya would be very helpful if you can add videos of bit manipulation

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

    length of longest subarray with two different toys.

  • @Akash-yr2if
    @Akash-yr2if Год назад

    Not everyone is blessing with an ADITYA VERMA during an OA

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

    Hey, please make more videos if you have time....yours video are like osm

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

    Same question as Longest Substring With K Unique Characters | Variable Size Sliding Window with K=2

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

    Longest substring with k unique characters hi hai ye , as far as I have listened the problem statement

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

    this question same as leetcode fruits into basket
    my solution for leetcode problem
    class Solution:
    def totalFruit(self, fruits: List[int]) -> int:
    i,j,mx,dic=0,0,0,{}
    k=2
    while j2:
    dic[fruits[i]]-=1
    if dic[fruits[i]]==0:
    del dic[fruits[i]]
    i+=1
    j+=1
    mx=max(mx,j-i)
    return mx

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

    Hi Sir, can you please post the list of variations for dp questions on longest increasing subsequence

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

    thanks bhai, after explanation solution click kar gya mujhe

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

    I had a question sir that print all the subsets whose sum >= k given

  • @Ash-fo4qs
    @Ash-fo4qs 2 года назад

    are other playlist like -- graph, BFS, DFS, BST, Backtracking.. available in patreon, or unacademy or somewhere else ??

  • @ROHIT-gv7xk
    @ROHIT-gv7xk 3 года назад +1

    bhaiya next kisi topic pr bnado tree, graph, backtracking plz placements aane wali hai

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

    Sir plz make a video on closest pair problem

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

    maximum substring length with two unique characters

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

    bro, giveaway result?

  • @ManishKumar-ux5un
    @ManishKumar-ux5un 3 года назад

    @Aditya sir, please improve your way of notation, you even denoted continuous as 'contd'......

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

    Happy New year Aditya boss

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

    Please make videos on trees and graphs as well

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

    patreon join krne ke liye subscription lena parta h kya???
    free me hi mil jata h

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

    Bhai videos banade yaar, aise KLPD kon deta hai abi abi maja aane laga tha tere explanation se

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

    Story type problems ki practice kaha se kare yai bhi bata do please

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

    Next video kab ayegi?? Please upload Graphs I am eagerly waiting for it,plz plz..I am loving the videos,it's explanation and just waiting for graphs playlist to arrive ..please do give a reply from your side wil be waiting for the reply also..😭

  • @neerajkumar-ik3vh
    @neerajkumar-ik3vh 3 года назад +1

    always waiting for your videos. Thanks

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

    Length of longest subarray with 2 unique characters .

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

    Problem ko phod diya , superb

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

    This question is same as Longest_K_unique_characters_substring but just K=2

    • @21sivansrawat
      @21sivansrawat Год назад

      but with one more condition to update max when map.size() < 2

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

    English me nahi
    Hindi me samjh liye hai
    🤪🤪🤪😂😂 Thanks

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

    fruits into basket is same as this

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

    question link??

  • @roshangupta8161
    @roshangupta8161 7 месяцев назад

    Mummy ji made this question interesting

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

    Awesome explanation sir
    Which year passout ?

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

    Great Work bro ❤️

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

    Really a good teaching style you have ,
    i was watching the whole series and now just after watching the problem statement i was able to solve the problem ,
    thank you sir.

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

    Bawal bhaiya, mza aa gya 💥❤💯
    Please bring Playlist for graph and tree Please please 🥺🥺

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

    /* John is at a toy store help him pick maximum number of toys. He can only select in a continuous manner and he can select only two types of toys.
    Example:
    Input:
    1
    abaccab */
    /* LONGEST SUBSTRING WITH TWO UNIQUE CHARACTERS */
    #include
    using namespace std;
    int pickToys(string str)
    {
    unordered_map mp;
    int i = 0, j = 0, maxi = 0;
    for (; j < str.size(); j++)
    {
    mp[str[j]]++;
    if (mp.size() == 2)
    maxi = max(maxi, j - i + 1);
    while (mp.size() > 2)
    {
    mp[str[i]]--;
    if (mp[str[i]] == 0)
    mp.erase(str[i]);
    i++;
    }
    }
    return maxi;
    }
    int main(int argc, char const *argv[])
    {
    string s;
    cin >> s;
    cout

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

    tussi great ho paaji

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

    Sir plz , backtracking ki series laao 🙏🙏🙏🙏🙏, your videos are really helpful

  • @aditya.bhadauriya
    @aditya.bhadauriya 3 года назад +1

    Eagerly waiting for next video.

  • @roshangupta8161
    @roshangupta8161 7 месяцев назад

    In a nutshell we need to find the longest substring with 2 different characters. !!

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

    Question waighrah to thik ye shraddha ka kya karna hai

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

    Here the problem is Longest k unique character substring where k=2 i.e mummy jee ki dusri waali condition.

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

      @Aditya verma kya h bhai ye😂😂

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

    Thank you so much

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

    bhaiya trees aur graphs pae bhi videos bana do

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

    Well explained 👍

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

    Longest substring with atmost k unique characters - just plotted a story of toy on that 😪

  • @rishikumar-rk7tk
    @rishikumar-rk7tk 3 года назад

    Apne competitive coding kiya tha kya apne college time pe??

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

    sir backtracking and graph mein kuch banao sir plz