Recursion Subset, Subsequence, String Questions

Поділитися
Вставка
  • Опубліковано 18 гру 2024

КОМЕНТАРІ • 376

  • @KunalKushwaha
    @KunalKushwaha  4 місяці тому +1

    DSA + interview preparation playlist: ua-cam.com/play/PL9gnSGHSqcnr_DxHsP7AW9ftq0AtAyYqJ.html

  • @amruthaa5876
    @amruthaa5876 3 роки тому +162

    If someone had skills like you especially the way you teach, they would launch this course as a paid one. Let it be anyone in this world. But you're here trying to help students like me and I'm very grateful. Thanks a ton, Kunal!

    • @Tomharry910
      @Tomharry910 Рік тому +29

      Dont give him ideas!

    • @utkrishtsneh8298
      @utkrishtsneh8298 29 днів тому +1

      Atleast the course would've been completed by now had it been paid

    • @Jatin-zn1px
      @Jatin-zn1px 18 днів тому

      ​@@utkrishtsneh8298true

  • @poojabennabhaktula4883
    @poojabennabhaktula4883 3 роки тому +36

    I dreaded recursion subset problem for almost an year now, and I stopped practicing because I was not very good with recursion. Now I can re-begin and work my way to FAANG

    • @jamtaranumber2841
      @jamtaranumber2841 2 роки тому

      me in the situation where i cant understand subset problems specially when for loop is used

    • @sameerakhatoon9508
      @sameerakhatoon9508 2 роки тому +1

      @@jamtaranumber2841 you still struggling w/ iterative approach? lemme know, i can help you, can share the explanation here

    • @jamtaranumber2841
      @jamtaranumber2841 2 роки тому +1

      @@sameerakhatoon9508 yeah can you share your discord / linkedin

    • @dubeyarts8661
      @dubeyarts8661 Рік тому

      Sister are u in good company now?

  • @aakashprasad9777
    @aakashprasad9777 3 роки тому +219

    Brother you are legend
    Several videos I have seen but I never understood these concepts
    You made these thing so easy
    Thanks Brother for such a beautiful and lovely content
    Concepts are fully cleared
    With the help of these videos now I have the faith and confidence to crack good companies
    Thanks Brother once again
    Great going
    Keep it up and deliver content like these

    • @KunalKushwaha
      @KunalKushwaha  3 роки тому +35

      Thank You 🙏

    • @gouravsyal2052
      @gouravsyal2052 2 роки тому +11

      @@KunalKushwaha at 1:16:50 we should not sort the array as it will rearrange the array and subsets will be wrong.
      And we know in subset : 2, 1, 2 is the subset of 2, 1, 2 but 1, 2, 2 is not subset of 2, 1, 2

    • @bijayMohanty12c5f
      @bijayMohanty12c5f Рік тому

      ​@@gouravsyal2052 yep bro

    • @bijayMohanty12c5f
      @bijayMohanty12c5f Рік тому

      2,1,2 is subset of 2,1,2

    • @bijayMohanty12c5f
      @bijayMohanty12c5f Рік тому

      ​​​@@KunalKushwaha sir it change order of array 2,1,2 while sort it become 1,2,2 1,2,2 is not subset of (2,1,2 ) .(2,1,2) is subset of 2,1,2 1:16:08

  • @Cloud-577
    @Cloud-577 3 роки тому +9

    no one explained recursion in so much detail like Kunal. Please someone give Kunal a medal already

  • @arunny9430
    @arunny9430 2 роки тому +8

    No one taught me recursion like you. I, like many others like me, initially thought I understood recursion completely after watching the Fibonacci and Factorial examples. But then the reality hit when I tried to solve some medium-level problems. I realized that my concepts are so hazy that I had no clue how to apply anything I learnt in logically writing code to solve a problem. This site not only taught me the concept, but it is also so thorough that it forced me see what is happening from different angles and write code in multiple ways. Thanks, Kunal, for making recursion as clear as algebra instead of it being some monster like vector calculus or something. You are so thorough. Awesome.

  • @shanmukhasivasai8335
    @shanmukhasivasai8335 2 роки тому +8

    First I found Difficulty in understanding the subset problem . After carefully going through I too got it .This guy is awesome

  • @bhavanamalapur5171
    @bhavanamalapur5171 Місяць тому +1

    I've been following your course for the past two months, and I just wanted to take a moment to thank you, Kunal. You're truly a coding legend! The way you break down complex problems and explain the solutions in such a simple, understandable way is genuinely amazing. Your teaching style is inspiring!

  • @armaanthakur8116
    @armaanthakur8116 10 місяців тому +1

    Everytime you make me like your video no matter what
    I don't know anyone who explains every small things like you
    I love that you made this beautiful course for free even though it's so much worth.
    May krishna bless you !

  • @shakibsiddiqui2999
    @shakibsiddiqui2999 3 роки тому +14

    Bro when i see your video it gives me confidence 👍

  • @ARYANTIWARI-y5t
    @ARYANTIWARI-y5t Місяць тому

    These are the best videos on UA-cam and still have less about of commends it's not good
    i guess public is so lazy . but in reality how much this person give the efforts to make these videos . i appreciate .. A BIG THANK YOU

  • @nizamkarivarsha1020
    @nizamkarivarsha1020 2 місяці тому +1

    I have seen so many videos related to java but no use after watching your videos Iam understanding concepts clearly
    Thankyou so much for helping those students who are not able to afford paid courses

  • @anujar5508
    @anujar5508 2 роки тому +8

    This is such a great video and it's incredible that you are not charging for sharing this immense knowledge.
    Just love the way you first explain the approach ,how to think and then actually solve the problem.Thankyou so much for these videos .
    And please please upload the graph and trees series 🙌

  • @chaitanyaprasad6924
    @chaitanyaprasad6924 3 роки тому +4

    Amazing!!!! You proved that a good teacher is not one who tells all the solutions but someone we can lead us to all solutions. As once I listen to you logic coding has become damn easy!!

  • @jamespeterson7824
    @jamespeterson7824 2 роки тому +6

    'Recursion made easy' by kunal.
    Good Intuation, Thought process and superb way of teaching.
    Good work 🙂

  • @misbashaikh3357
    @misbashaikh3357 Рік тому +4

    This video took me 8 hr to get completed but it all worth it. Thank you so much ❤

  • @charon71
    @charon71 9 місяців тому

    it is unbelievable how easy you can solve recursion tasks after watching these videos. You really get told HOW to think. Thanks alot!

  • @singhsuryanshu
    @singhsuryanshu 3 роки тому +11

    Kunal, I cannot believe this is so easy. I wrapped my head around with backtracking a lot and was still confused. Even took sessions of a paid educational website to understand backtracking. And literally I just watched your video once and all concepts are clear.
    You are legend.

    • @manavarora7644
      @manavarora7644 3 роки тому +1

      +1

    • @rishika9102
      @rishika9102 3 роки тому

      Hii can u please tell me that is this course worth following as m a beginner no programming background plz reply confused

    • @rishika9102
      @rishika9102 3 роки тому

      @@manavarora7644 Hii can u please tell me that is this course worth following as m a beginner no programming background plz reply m confused

    • @Gookun
      @Gookun 2 роки тому

      @@rishika9102 PICK A programming language first, then learn it.

  • @sadmansakibmugdho4134
    @sadmansakibmugdho4134 3 роки тому +47

    Hello Kunal. I want to know, After the DSA course, will you show us how to use our skills in open source and all that stuffs till how to approach in a company? If not then please consider this.🙏🙏🙏

  • @whatwelearntoday
    @whatwelearntoday Рік тому +1

    This is the first time that i understood recursion in subsets after a lot of hunt for this material .Thanks a lot!

  • @aniketshetty6694
    @aniketshetty6694 Рік тому +5

    Your confidence level is what makes you different from others. The best dsa course ever!

    • @rockrk2519
      @rockrk2519 Рік тому

      can anybody please tell in which video kunal has covered sliding window...

    • @poorpanda9033
      @poorpanda9033 Рік тому +1

      @@rockrk2519 he hasn't covered yet he definitely will

  • @hindutva5646
    @hindutva5646 10 місяців тому +1

    After all that your efforts and following all the previous playlist videos , Now i get some confidence in DSA to solve problems easily . Thanks Kunal bhaiyaa (Sir) for all that quality Content that i hunt for all over youtube

  • @omkarg01
    @omkarg01 3 роки тому +14

    24:52 - 24:58 If I am not wrong, sliding window has not covered.

    • @rakeshpotnuru
      @rakeshpotnuru 3 роки тому +7

      Don't worry he keeps track of syllabus on github issue, maybe mistakenly said that.

  • @davidmwangi4312
    @davidmwangi4312 3 роки тому +8

    Best recursion series I have watched.Excellent explanation. Thanks Kunal

  • @premraja55
    @premraja55 3 роки тому +6

    Legendary way of teaching! Thanks brother

  • @mathlover7688
    @mathlover7688 Рік тому

    ye kya ho raha dsa se main bore kyon nhi ho raha ye toh magic ho gya kunal bhai ,love you bhai aisa best content ke liye ab lag raha main sikh jaunga dsa

  • @beb57swatimohapatra21
    @beb57swatimohapatra21 2 роки тому +1

    Finally!!! I understood these topics... you r a legend kunall

  • @rakeshsagar9510
    @rakeshsagar9510 Рік тому +1

    I find his sub sequence tutorials much informative and communication is superb.

  • @prasadm3614
    @prasadm3614 2 роки тому

    Insanely simple explanation of subsets... M awestruck

  • @bhavyabansal1143
    @bhavyabansal1143 2 роки тому +10

    Thank you so much for explaining this beautifully. When can we expected videos for DP, graphs and trees?

  • @Helly_Patel
    @Helly_Patel 2 роки тому +4

    Thanks for teaching us like no one did till now!! One small request, please make lectures on dynamic programming as well!!

  • @musicalboy2975
    @musicalboy2975 4 місяці тому

    Man you are freaking awesome. I feel confident on recursion and backtracing on watching your series .

  • @faizanhaider3953
    @faizanhaider3953 2 роки тому +1

    phele to dur se pair chu k parNaam bro 🙏🙏 DhanSuuu lecture Kunal bhai... Nobody teaches like you.. but plz complete krdo bhai playlist... 🙏🙏

  • @kishanpareek2848
    @kishanpareek2848 3 роки тому +1

    Ye Kunal ka course bhot mast hai. Sab samaj aa gya

  • @HARSHKUMAR-g2d6u
    @HARSHKUMAR-g2d6u 7 місяців тому

    Incredible course,
    the concept which you tell us in the starting of the recursion is enough to solve this problem and the track the answer in the function body is the awesome way to hold the answer more then the in the arguments

  • @Nkchauhan-o9y
    @Nkchauhan-o9y 6 місяців тому

    I like the way you teach it is amazing that you are giving the tricks which person can apply to various types of questions. It's true even now i feal it is the best course for DSA out there on UA-cam thanks for your valuable time and efforts for us.
    It would be so good if this was a whole course of DSA i would really like to learn whole DSA from you if it is feasible Please provide dynamic programing videos too! people would love it.
    Thanks for course and your efforts!

  • @varunkumar6223
    @varunkumar6223 2 роки тому +5

    for the last question instead of adding the start or end index , if found duplicate just start the inner loop with outerarray size / 2 and it works fine
    #include

    using namespace std;
    vector subsetrec(string main,string pro){
    vector s;
    if(main.empty()){
    s.push_back(pro);
    return s;
    }
    char ch = main[0];
    vector s1 = subsetrec(main.substr(1),pro);
    vector s2 = subsetrec(main.substr(1),pro+ch);
    s.insert(s.end(),s1.begin(),s1.end());
    s.insert(s.end(),s2.begin(),s2.end());
    return s;
    }
    void subsetitr(){
    vector v{1,2,3,3};
    vector res;
    res.push_back({ });
    for(int i=0;i 0 && v[i] == v[i-1]) j= (n/2); // LOOK HERE
    for(;j

    • @gnanaprakashm843
      @gnanaprakashm843 Рік тому +1

      Can you explain your thought process behind why it works ?

    • @laxminarayanakoyyana1753
      @laxminarayanakoyyana1753 Рік тому +1

      @@gnanaprakashm843 he is just removing duplicates bro , that's it.

    • @gnanaprakashm843
      @gnanaprakashm843 Рік тому +1

      @@laxminarayanakoyyana1753 I see I'll look into it. thanks 🙏

  • @mohamedjasimazizg442
    @mohamedjasimazizg442 Рік тому

    I have been watching your videos for so long it's been very helpful to grow personally

  • @arishkhan6300
    @arishkhan6300 2 роки тому +1

    Brother you are legend i see the spirit in you to become s Minecraft stremer . You will achive great success as gamer.

  • @aakashyadav9117
    @aakashyadav9117 Рік тому

    you are genius man , i did the subset problem of string "abc" and i used loop inside that , and you simple printed using recursion 🙌

  • @jatinkoli3389
    @jatinkoli3389 3 роки тому +1

    just started ur dsa course and fell in love with that

  • @yashkoolwal196
    @yashkoolwal196 3 роки тому +8

    One of most awaited vidoe

  • @KM-rh8gd
    @KM-rh8gd 4 місяці тому

    Bro i was starting up with my college and wanted to start with DSA glad that i have the right guide and tecaher.

  • @ombhandari6148
    @ombhandari6148 2 роки тому +1

    Thank you brother
    Finally I understood how to solve the subsets problem..
    Thanks a lot brother.
    You are doing great

  • @anuragbudakoti755
    @anuragbudakoti755 2 роки тому

    Dhanyawad apka iss DSA course ke liye

  • @panchanansahoo1463
    @panchanansahoo1463 2 роки тому +2

    Nice video kunal. For the last question we can add a check before adding the inner list to the outer list, If the outer list already contains the inner list or not

  • @alonbrim
    @alonbrim 2 роки тому +1

    Great Video! Very well explained! Great job Kunal, thank you very much!

  • @akashnag6459
    @akashnag6459 Рік тому

    Easiest explanation of recursion in internet.

  • @aasisinha6100
    @aasisinha6100 2 роки тому

    Truely informative and lots of creativity in teaching...became friend without meeting you..

  • @dsrfacts6483
    @dsrfacts6483 2 роки тому +2

    Amazing content bro... Keep doing the good work..Lots of luck 🎉

  • @vaibhavghatge8553
    @vaibhavghatge8553 Рік тому

    Really awesome way of teaching finally, thinking in the recursive way, |2^n sub set

  • @simranpreetkaur114
    @simranpreetkaur114 2 роки тому +28

    In ques 9 we can just check if outer list contains that subset. If it doesn't contain, then only we should add it in outer. This way we'll avoid duplicates:
    public static List subsetDuplicates(int[] arr)
    {
    List outer = new ArrayList();
    outer.add(new ArrayList());
    for(int num: arr)
    {
    int n= outer.size();
    for (int i = 0; i < n; i++)
    {
    List inner=new ArrayList(outer.get(i));
    inner.add(num);
    if(!outer.contains(inner))
    outer.add(inner);
    }
    }
    return outer;
    }

    • @akashdeepgupta2085
      @akashdeepgupta2085 Рік тому +2

      1:21:31 it will be good if we sort the array first, for the test cases like [1, 2,2,2] or [4, 4,4,1,4]. otherwise it will fail.

    • @its_shivam_jha
      @its_shivam_jha Рік тому

      Great job man!

    • @kcalbduorp3499
      @kcalbduorp3499 Рік тому +2

      .contains will take another internal nested loop so it increases the time complexity...

    • @akashdeepgupta2085
      @akashdeepgupta2085 Рік тому +1

      @@kcalbduorp3499 yes

  • @DSrikanthd
    @DSrikanthd 2 роки тому +1

    This is just brilliant Brother, Keep doing it. Just waiting for the DP series, Please do it soon.

  • @DevanshuAugusty
    @DevanshuAugusty 2 роки тому +6

    24:55 when did he teach sliding window?

  • @iamyasirameer
    @iamyasirameer Місяць тому

    The man who invented the Recursion!

  • @sriharshakandurivenkatases2587
    @sriharshakandurivenkatases2587 2 роки тому +1

    We are grateful to you for the knowledge you are providing for free🙏🙏
    Waiting for your next DSA video
    #DSAWithKunal❤

  • @rishabhrawat8197
    @rishabhrawat8197 2 роки тому +1

    touched my heart as always

  • @prashanthprashanth7570
    @prashanthprashanth7570 3 місяці тому

    Broo tnq very much ❤❤❤ you are helping me a lot for learning recursion. since in these topic i am very confused.However i see your videos ❤ it's like a wow.

  • @Tomharry910
    @Tomharry910 Рік тому

    Another great video. Thanks for the good work Kunal. Wish you the very best!

  • @abdulrauf7815
    @abdulrauf7815 Рік тому

    The definition and recursion tree for subsets was very very great❤❤

  • @subhankarkanrar9494
    @subhankarkanrar9494 9 місяців тому

    Just Enjoying every moment ❤. Love it😊

  • @PrasunKundu
    @PrasunKundu 3 роки тому +4

    Wait kar rha tha iske liye....

  • @apurwarokade3863
    @apurwarokade3863 11 місяців тому

    You are a genius kunal 😊

  • @arpithamjade386
    @arpithamjade386 Рік тому

    2:20 easy method
    static String rem1(String str,int start){
    if (start>=str.length()) {
    return "";
    }
    return str.charAt(start)=='a' ? rem1(str, start+1) : str.charAt(start) + rem1(str, ++start);
    }

  • @gauravdham9982
    @gauravdham9982 Рік тому

    Great work bro !! Keep it up and keep making such videos for others to learn!!

  • @devesh819
    @devesh819 3 роки тому +8

    A new episode of recussion session 😂😂

  • @komalchauhan7535
    @komalchauhan7535 5 місяців тому

    Great Video, Please complete this bootcamp asap.😇

  • @atharvparlikar8765
    @atharvparlikar8765 3 роки тому +5

    Waa ye hi time mila tha upload karne ko 😐

  • @adityapalve3752
    @adityapalve3752 3 роки тому +2

    very good video, i used to detest recursion kinda like it more than iteration now

  • @BrajBliss
    @BrajBliss 2 роки тому +2

    This and the merge sort video are the only one I just can't get in my head.

  • @29_jayavishnur89
    @29_jayavishnur89 4 місяці тому +1

    Fun fact: In iterating subsequence with duplicate you can set the start as outer.size() /2, thereby u dont need to use end variable itself

  • @ragulp5489
    @ragulp5489 2 роки тому +1

    Thanks bro all the concepts u deliver is so clear sir. pls make some vdos on windows sliding, two pointer approach too sir.

  • @andretheruler714
    @andretheruler714 2 роки тому +3

    recursion is still hard but you explained it well

  • @projectsdb4034
    @projectsdb4034 Рік тому

    Thanks for the great tutorial please continue the series

  • @harshjaiswal1634
    @harshjaiswal1634 3 роки тому +2

    Recursion session... Just like therapy session

  • @beyourself637
    @beyourself637 6 місяців тому

    00:03 String Questions and Subsequences
    03:35 Recursion subset and subsequence concepts
    10:19 Explanation of function call and process in string operations.
    13:46 Recursion and string processing explained
    21:02 Understanding recursion and string questions
    24:31 Subset, subsequence, and string questions are important for interview preparation.
    31:26 Understanding recursion and subset/sequence problems.
    34:43 Recursion and string questions in a UA-cam video
    40:49 Discussion on various functions and activities using code
    44:06 Recursion and string questions are challenging.
    51:15 The video discusses creating subsequence and string questions.
    54:30 Sequencing, string manipulation, and recursion in programming
    1:01:07 Explaining recursion and its use in solving problems
    1:04:05 Creating a new list based on the original list size.
    1:10:16 Understanding subsets and complexities
    1:13:16 Preventing duplicate elements in newly created subjects

  • @gitanshutalwar1604
    @gitanshutalwar1604 3 роки тому +2

    Bro this content is great. thanks for your effort
    Just one question man how did you get this much knowledge

  • @plutomessi21
    @plutomessi21 Рік тому

    In this example, the recursiveSubstring method prints the current substring and then makes a recursive call with s.substring(1). Each recursive call creates a new substring starting from the second character of the previous substring.
    Output:
    vbnet
    Copy code
    Substring: abcdef
    Substring: bcdef
    Substring: cdef
    Substring: def
    Substring: ef
    Substring: f
    Empty String

  • @muzi9786
    @muzi9786 2 роки тому +1

    You are the best !!! please make some video about DP thanks ahead!!!

  • @alpersener4269
    @alpersener4269 Рік тому

    bro you're awesome thanks for the concepts you have taught us.👑👑👑

    • @SAIFALI-rn5cs
      @SAIFALI-rn5cs Рік тому

      Bro, why I am getting error at p:p+ch, saying as Syntax error on token " : ", invalid AssignmentOperator.

  • @vishvsalvi9887
    @vishvsalvi9887 2 роки тому

    " Take it and ignore it " 🙌

  • @koushanikarmakar5159
    @koushanikarmakar5159 3 роки тому +3

    Thank you so much ! I always had problems with these type of questions. I have better grasp on these topics now.

  • @dakubhai6014
    @dakubhai6014 3 роки тому +1

    U r diamond dude...May lord protect u from Aliens for the boon of mankind.

  • @onelove177
    @onelove177 8 місяців тому

    Kunal bro you are Legend❤

  • @subhashkumar5896
    @subhashkumar5896 2 роки тому

    Kunal bhai tu na bhut mast samjhata h....

  • @karthick7983
    @karthick7983 3 роки тому +2

    10:05
    le kunal : ccd
    le siri : yeah bruhh!! LOL.

  • @anushkjain4528
    @anushkjain4528 6 місяців тому

    That was beautiful @kunal.

  • @govindvarshney5116
    @govindvarshney5116 7 місяців тому

    bro that was ammazing.

  • @siddhigupta7673
    @siddhigupta7673 Рік тому +1

    pls kunal complete the course no other course can match the level of content u were providing

  • @ritikadhiman101
    @ritikadhiman101 3 роки тому +1

    He is really good!

  • @Fawzaan
    @Fawzaan 3 місяці тому +1

    The Goat ❤

  • @dmitriiserikov1528
    @dmitriiserikov1528 2 роки тому +2

    @Kunal Kushwaha
    , the solution in Q9 changes the order of the original array. Wouldn't the result be considered as a list of subsets and not a list of subsequences?

  • @nagasatya5969
    @nagasatya5969 Рік тому

    Kunal, please try completing the series. It'd be of great help. cuz of all the videos I've watched on recursion, all of them were very specific to the prlms they taught and none of them explained how recursion actually works. I don't think they'd do any better with topics like dp. So, if you can, complete the series

  • @nishu0766
    @nishu0766 4 місяці тому

    please upload all the remaining topics of this DSA playlist as soon as possible

  • @siyavats6892
    @siyavats6892 2 роки тому

    thank you so much kunal♥

  • @sameerakhatoon9508
    @sameerakhatoon9508 2 роки тому +2

    for qn 9, please find my recursive solution below
    approach: if we ignore the occuring of duplicates char means we ignore each of that duplicate char
    public class Recursion{
    public static void main(String[] args) {
    System.out.println(subSetsWithDupInString("122", ""));
    }
    static ArrayList subSetsWithDupInString(String str, String ans){
    if(str.isEmpty()){
    ArrayList ls = new ArrayList();
    ls.add(ans);
    return ls;
    }
    char ch = str.charAt(0);
    ArrayList left = new ArrayList();
    ArrayList right = new ArrayList();

    int i = 1;
    while(i

  • @ketara1234od
    @ketara1234od Рік тому

    you are the BEST !!

  • @cloudy-head
    @cloudy-head 2 роки тому +1

    1:05:50, I have a slight simpler approach for this.
    public static void main(String[] args) {
    ArrayList arr = new ArrayList();
    arr.add(" ");
    String s = "abc";
    for(int i=0;i

  • @jatinkoli3389
    @jatinkoli3389 3 роки тому +3

    Bhaiya i am getting admsion into DTU CS can u please make a video 1st year roadmap
    I was waiting to get into college to start programming with ur course
    Loving ur confidence and content

    • @devjoshi7062
      @devjoshi7062 3 роки тому

      ua-cam.com/play/PLPX75d4curILdTmhcM5iJ6ReNx-LKW12P.html
      here, these are old videos of kunal when he used to work with a ed-tech, he has made a complete 4 year roadmap for B.Tech students

  • @ShubhamKumar-vu4ql
    @ShubhamKumar-vu4ql 2 роки тому +1

    44:21 can anyone explain the passing in the argument solution. i.e. how will u return two recursive calls simultansly, any help appreciated!