Recursion Subset, Subsequence, String Questions

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

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

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

    DSA + interview preparation playlist: ruclips.net/p/PL9gnSGHSqcnr_DxHsP7AW9ftq0AtAyYqJ

  • @amruthaa5876
    @amruthaa5876 2 года назад +147

    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!

  • @suzanaangboo2448
    @suzanaangboo2448 2 года назад +10

    difficult to understand iterative and duplicate problems :(

  • @aakashprasad9777
    @aakashprasad9777 2 года назад +214

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

      Thank You 🙏

    • @gouravsyal2052
      @gouravsyal2052 2 года назад +10

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

      ​@@gouravsyal2052 yep bro

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

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

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

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

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

    24:55 when did he teach sliding window?

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

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

    Q9 : Sub sequences of a string with duplicate elements
    This last question can be solved in a shorter way like this:
    public static ArrayList subsequenceIterativeDuplicate(int[] arr)
    {
    ArrayList outerList = new ArrayList();
    outerList.add(new ArrayList());
    for(int num : arr)
    {
    int outerListSize = outerList.size();
    for(int i=0;i

    • @GoodBoy_._
      @GoodBoy_._ 4 месяца назад

      I also did the same thing...

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

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

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

      @@sameerakhatoon9508 yeah can you share your discord / linkedin

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

      Sister are u in good company now?

  • @omkarg01
    @omkarg01 2 года назад +13

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

    • @rakeshpotnuru
      @rakeshpotnuru 2 года назад +7

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

  • @shakibsiddiqui2999
    @shakibsiddiqui2999 2 года назад +14

    Bro when i see your video it gives me confidence 👍

  • @nizamkarivarsha1020
    @nizamkarivarsha1020 10 дней назад +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

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

    Guys don't take any minute word coming from his mouths lightly what he speaks comes from his experience so what i suggest watch video one time solve some questions come again and you will grasp things more efficiently

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

    Hug Diya na Last Question me nhi aayi intution smgh only for last question baki puri video bdiya h bs last question 😒❤

  • @GudipudiAbhinav
    @GudipudiAbhinav 3 месяца назад +1

    In the last question we can simply do that question as the previous question but after that just check whether each element is present in the list if it is there just remove duplicates from the list which takes O(N) time complexity. But brother you are sorting the array which takes O(NLog N) which is not effecient as compared to removing the duplicates after doing this question as the previous question.

  • @bhavyabansal1143
    @bhavyabansal1143 2 года назад +10

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

  • @devesh819
    @devesh819 2 года назад +8

    A new episode of recussion session 😂😂

  • @mohammedadnan2449
    @mohammedadnan2449 Год назад +14

    Q9 : Subsequences of a string with duplicate elements
    Can be solved in easier way with the code snippet mentioned below:-
    ------------------------------------------------------
    List outerList = new ArrayList();//outerList
    outerList.add(new ArrayList());
    for (int num : arr) {
    int size = outerList.size();
    for (int i = 0; i < size; i++) {
    List internalList = new ArrayList(outerList.get(i));
    internalList.add(num);
    if (!outerList.contains(internalList)) {
    outerList.add(internalList);
    }
    }
    }
    return outerList;
    ---------------------------------------------------------

    • @Mlakshman-w9k
      @Mlakshman-w9k 8 месяцев назад

      contains method takes O(n) of time then it leads to O(n^3) for overall time complexity

    • @Mlakshman-w9k
      @Mlakshman-w9k 8 месяцев назад +1

      static List subSetDuplicates(int[] nums) {
      Arrays.sort(nums);
      List outerList = new ArrayList();
      outerList.add(new ArrayList());
      for (int i = 0 ;i < nums.length ; i++) {
      int start = 0;
      int end = outerList.size();
      if( i > 0 && nums[i] == nums[i - 1]){
      start = start + (end - start ) / 2;
      }
      for (int j = start; j < end; j++) {
      ArrayList intenalList = new ArrayList(outerList.get(j));
      intenalList.add(nums[i]);
      outerList.add(intenalList);
      }
      }
      return outerList;
      }

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

    Waa ye hi time mila tha upload karne ko 😐

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

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

    Which video has sliding window problem?

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

      +1

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

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

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

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

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

    How is subset question's time complexity O(N 2^N). Even though the outer loop runs n times, the inner loop is not always O(2^N). You end up running a total of (2^0 + 2^1 + .. 2^(N-1)) = 2^N commands. The time complexity should therefore be O(2^N).

  • @aakashgoswami2356
    @aakashgoswami2356 2 года назад +17

    Other : How to solve a problem.
    Le kunal : How to approach a problem.

  • @RakeshkumarD-py9iz
    @RakeshkumarD-py9iz Год назад +1

    hey kunal..still u didn't upload dynamic programming, graph, trees etc.....

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

  • @29_jayavishnur89
    @29_jayavishnur89 Месяц назад +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

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

    Not the best approach but to handle duplicates we can do this in previous code.
    if(!outer.contains(internal)){
    outer.add(internal);
    }

  • @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 10 месяцев назад +1

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

    • @gnanaprakashm843
      @gnanaprakashm843 10 месяцев назад +1

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

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

    since a set does not allow duplicates , so shldnt (2,2) , (1,2,2) be removed from final answer ?

  • @karanbadhwar4113
    @karanbadhwar4113 4 месяца назад +1

    Kisi ko time complexity smj aai ? to smja do please
    Loop I guess 2^(N-1) time chalega har element ko process krte time, fir yaha complexity 2^N kyu hai

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

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

  • @santoshis2568
    @santoshis2568 10 месяцев назад +1

    hi Kunal can you please do sliding window problems?

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

    I have a question...subset of array should be in the same order right so if we sort the array then it's subsets won't be in the same order as the original array given to us.

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

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

  • @Cloud-577
    @Cloud-577 2 года назад +7

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

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

    Hi, can anyone explain me Why we use outer.get(i) at 1:08:07 .

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

    if we are sorting the array then will it not change the ans for subset question as [1, 2, 3] has different subsets than [2, 3, 1]

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

    I have a doubt in subsets introducation is empty set also a subset of set [2.5,9] as i had learnt earlier in cpp in my previous data structure long back that time i didnt knew recursion is a topic and you not mentioned.

  • @simranpreetkaur114
    @simranpreetkaur114 Год назад +27

    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

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

    brother can you make videos on patterns like 2-pointer, prefix sum, merge intervals etc. Questions from these topics are a lot

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

      Ofc

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

      @@KunalKushwaha Is it possible for you to provide these codes in python. I am literally struck

  • @misbashaikh3357
    @misbashaikh3357 10 месяцев назад +3

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

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

    Brother can you please tell me which keyboard you are using

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

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

  • @SravanthiPotuluri-k5c
    @SravanthiPotuluri-k5c 9 месяцев назад +1

    Please make a video on subarray concepts

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

    this part from subseqAscii shows error in c++
    vectorright =check_str(p+(ch+0),up.substr(1));
    it works well on java but not on c++
    if anyone can explain please

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

      same problem they are not working in python

  • @webdevgaurav
    @webdevgaurav 11 месяцев назад +1

    you should have been a doctor

  • @ShubhamKumar-vu4ql
    @ShubhamKumar-vu4ql Год назад +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!

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

    Legendary way of teaching! Thanks brother

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

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

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

      ruclips.net/p/PLPX75d4curILdTmhcM5iJ6ReNx-LKW12P
      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

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

    Hi Kunal, Can you please recommend a book for DSA. Similar type content as of you. Please 🙏🏻

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

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

    I thought to take half of outer list size as start index, but sooner realize what if multiple duplicate elements are coming, it will fail to survive that condition

  • @chinmayatewari7589
    @chinmayatewari7589 11 месяцев назад +2

    DP PLEASE BROOOOOO

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

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

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

    you explained very well but still i am not able to code or solve the assignment problems please suggest something to overcome

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

    From 58:26 I have doubt, I need to do it again

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

    Bro can we just use a check of .contain() on outer for previous set in Duplicate Question ?

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

      True, it becomes so simple there itself.
      Solution:
      if(!outer.contains(inner))
      outer.add(inner);

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

      @@vaibhavnagwani9686 yea and kunal solution will make it incorrect as after sorting (3,2,1); (1,2,3) ... will show same ans which is incorrect.

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

    recursion is still hard but you explained it well

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

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

  • @yashkoolwal196
    @yashkoolwal196 2 года назад +8

    One of most awaited vidoe

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

    Wait kar rha tha iske liye....

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

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

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

    bhai 24:55 sliding window? did i miss anything?

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

    Yar last wala iteration ka logic samaj nai aya

  • @dhruvbhaskarsoni2952
    @dhruvbhaskarsoni2952 2 года назад +10

    Actually finding the subset with duplicates using iteration is easy then what kunal tried to code ..you need to just check whether the outer array contains the ans we have obtained and if yes then dont add the ans to the outer array
    My Code is:
    import java.util.ArrayList;
    import java.util.List;
    public class subsetsusingrecursoncopy {
    public static void main(String[] args) {
    int [] arr={1,2,2};
    List ans=iteration(arr);
    System.out.println(ans);
    }
    static List iteration(int [] arr)
    {
    ArrayList inner=new ArrayList();
    List outer=new ArrayList();
    outer.add(inner);
    for(int n:arr)
    {
    int a=outer.size();
    for(int i=0;i

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

      although this is easier to code and think about, it adds a O(n) order time for each subset. and since there are 2^n subsets, it adds a total of O(n * 2^n) operations to the algo. it doesn't change the final complexity but for real world applications this might be a significant difference. something to consider.

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

      I've also come with same approach.

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

    some sliding window problems if possible please include .. Will be very helpful :)

  • @hindutva5646
    @hindutva5646 8 месяцев назад +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

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

  • @davidmwangi4312
    @davidmwangi4312 2 года назад +8

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

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

    what will be the time and space complexity of the processed/un-processed method?

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

    1000cr ka package wala banda, noice.

  • @sushmaraj3824
    @sushmaraj3824 6 дней назад

    how is it "How simple was it"? I am dying to understand the recurssion trree,it literally took me 2hrs to understand the so called simple subsequences..... it hurts

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

    Kunal can you make a sheet of qstins 200-300 for PBC companies it'll be helpful for revision as well as prepration

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

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

    Shall i use C++ list with splice() to imitate java's arraylist used with addAll()?

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

    public class Main {
    public static void main(String[] args) {
    System.out.println("Hello world!");
    String s="aaaaaaaababababbbaaaaaa";
    System.out.println(fun(s,0,new StringBuilder()));
    }
    static String fun (String s,int i,StringBuilder a)
    {
    if(i==s.length())
    return a.toString();
    if(s.charAt(i)!='a')
    {
    a.append(s.charAt(i));
    }
    return fun(s,i+1,a);
    }
    }
    use stringbuilder it is more efficient that srting class

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

    Brother....I'm waiting for your reactjs and vanilla js course...Hope you see this comment

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

    Bhaiii you are legend, when you are coming with OOP java tutorials

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

    string st(string org,string ans)
    {
    if(org.empty() == 1)
    {
    return ans;
    }
    if(org.find("apple") == 0)
    {
    string temp = org;
    org = "";
    for(int j = 5;j

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

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

  • @armaanthakur8116
    @armaanthakur8116 7 месяцев назад +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 !

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

    removing a:
    public class strrecurr {
    public static void main(String[] args) {
    removea("", "aabcsydufcgiueaad");
    }
    static void removea(String answer, String strgiven) {
    if (strgiven.isEmpty()) {
    System.out.println(answer);
    return;
    }
    if (strgiven.charAt(0) == 'a') {
    removea(answer, strgiven.substring(1));
    } else {
    answer = answer + strgiven.charAt(0);
    removea(answer, strgiven.substring(1));
    }
    }
    }

  • @TechJobs9
    @TechJobs9 3 дня назад

    In the last question, why not track duplicates using a HashSet?

  • @amitkumar-pj3py
    @amitkumar-pj3py Год назад

    Dont want to print space in substring :-[abc, ab, ac, a, bc, b, c, ] output should [abc, ab, ac, a, bc, b, c]
    ==============
    public static ArrayList SubStringArrayList (String p, String up,ArrayList list)
    {
    if(up.isEmpty())
    {
    //System.out.println(p);
    list.add(p);
    return list;
    }
    char ch=up.charAt(0);
    //Add String in UnProcessed
    SubStringArrayList(p+ch,up.substring(1),list);
    //Return Processed/
    SubStringArrayList(p,up.substring(1),list);
    return list;
    }
    please Help on this @Kunal

  • @prashanthprashanth7570
    @prashanthprashanth7570 26 дней назад

    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.

  • @Fawzaan
    @Fawzaan 11 дней назад +1

    The Goat ❤

  • @suryanshgr4610
    @suryanshgr4610 27 дней назад

    1:10:43 how's time complexity is O(n*2^n). I think it should be O(2^n)

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

    Sir aapke cursor ka color change karo

  • @AYUSHKUMAR-qg2sy
    @AYUSHKUMAR-qg2sy 2 года назад +1

    Can u please make video on dynamic programming also

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

    static ArrayList subset2(String n , String ans){
    ArrayList l1 = new ArrayList();
    if(n.isEmpty()) {
    l1.add(ans);
    return l1;
    }
    char currentCharacter = n.charAt(0);
    ArrayList ans1 = subset2(n.substring(1), ans+currentCharacter);
    ArrayList ans2 = subset2(n.substring(1), ans);

    l1.addAll(ans1);
    l1.addAll(ans2);
    return l1;
    }

  • @soumyadeepchatterjee2189
    @soumyadeepchatterjee2189 6 месяцев назад

    Skip a Character(Using StringBuilder)
    static StringBuilder recursive(String st, char skip, StringBuilder sb, int index) {
    if (index >= st.length()) {
    return sb;
    }
    char ch = st.charAt(index);
    if (ch != skip) {
    sb.append(ch);
    }
    return recursive(st, skip, sb, index + 1);
    }
    Skip a string(Using StringBuilder)
    static StringBuilder recursive(String st, String skip, StringBuilder sb, int lastIndex) {
    int indexSkipStr = st.indexOf(skip, lastIndex);
    if (indexSkipStr == -1) {
    return sb.append(st.substring(lastIndex));
    }
    sb.append(st, lastIndex, indexSkipStr);
    return recursive(st, skip, sb, indexSkipStr + skip.length());
    }

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

    Recursion session... Just like therapy session

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

    171. Excel Sheet Column Number
    class Solution {
    public int titleToNumber(String columnTitle) {
    int ans = 0;
    return helper(columnTitle, ans);
    }
    static int helper(String columnTitle, int ans){
    if(columnTitle.isEmpty()){
    return ans;
    }

    char ch = columnTitle.charAt(0);
    int charVal = ch - 'A' + 1;
    return helper(columnTitle.substring(1), ans*26+charVal);
    }

    }

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

    Hey kunal in last question u told that complexity will be same as previous..but u sorted the array so i think nlogn should be multiplied with previous time complexity. Am i true.. please clarify

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

    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 RUclips 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

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

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