L7. All Kind of Patterns in Recursion | Print All | Print one | Count

แชร์
ฝัง
  • เผยแพร่เมื่อ 27 ธ.ค. 2024

ความคิดเห็น • 655

  • @manavpatnaik222
    @manavpatnaik222 9 หลายเดือนก่อน +156

    Folks, these are actually very important patterns to keep in mind with respect to recursion. If you understand these then a lot of Binary Tree problems become very simple. I don't think any one else teaches patterns such as these in a separate video.
    Great work man!

  • @pralhadmule677
    @pralhadmule677 9 หลายเดือนก่อน +37

    Striver always rocks!🔥🔥 In every video, he explains all the concepts in-depth. His teaching style is very unique. He starts from the basics and gradually moves up to advanced levels of questions, yet you never feel like you're solving an advanced-level question. That's the magic of Striver. I never believed that someone could teach such premium content on TH-cam for free. Hats off to this man! 💕🔥🙏

  • @manashroy9469
    @manashroy9469 2 ปีที่แล้ว +88

    I'm so grateful that I found this channel. Whoever is here, may be you found this channel late but don't worry whenever you find this channel your life is gonna take change into a new direction. I'm sooo soooo grateful to have this.

    • @dtu-emgeenear3274
      @dtu-emgeenear3274 2 ปีที่แล้ว +7

      whats the status brother , is it still grateful ? have you learnt dp or left in midway

    • @rkdhillon8450
      @rkdhillon8450 6 หลายเดือนก่อน

      @@dtu-emgeenear3274 what's your status?

    • @Maverick-vu9kl
      @Maverick-vu9kl 5 หลายเดือนก่อน

      @@dtu-emgeenear3274 what's your status man 😐😐

    • @3lpme
      @3lpme 4 หลายเดือนก่อน

      ​@@Maverick-vu9kl Mine just started ,found this video now, im about to check if this helps me to do recursion problems on my own

  • @VishalGupta-xw2rp
    @VishalGupta-xw2rp 2 ปีที่แล้ว +217

    Notes to Self :-
    All possible patters from *Subsequence*
    1. Print All the Subsequence
    2. Print all Sq which sums to K
    3. Print only 1st Sq which sums to K
    4. Print the count of Sq which sums to K
    *Note In order to understand Printing all subsequence in absolute clear way..... Just take the example which striver gave in previous video
    Now create a table of all the output and match it with the power set. A magic will happen and you will be totally blown away 🔥🔥🔥

    • @aniksadhukhan8477
      @aniksadhukhan8477 10 หลายเดือนก่อน +10

      This man is the sachin ramesh tendulkar of coding.

    • @ADITYARAJ-x8k5w
      @ADITYARAJ-x8k5w 6 หลายเดือนก่อน +2

      @@aniksadhukhan8477 Striver ?

    • @garh.kumaon
      @garh.kumaon 3 หลายเดือนก่อน

      ​@@ADITYARAJ-x8k5w this teacher's name is striver.

    • @abhinavennala9613
      @abhinavennala9613 3 หลายเดือนก่อน

      @@ADITYARAJ-x8k5w yes

  • @Kumkum-n9v
    @Kumkum-n9v 5 หลายเดือนก่อน +9

    After struggling here and there for 2 days on this topic, I understood it all in one go. The best thing about this man is he knows where a beginner might be stuck and thus shows how to think by doing dry runs, coding, and debugging with us.

  • @adityakumar-sp4ki
    @adityakumar-sp4ki 2 ปีที่แล้ว +23

    Previously, I never understand the concepts of recursion, and here it got fitted into my mind permanently.

  • @rabbanimunna6992
    @rabbanimunna6992 ปีที่แล้ว +11

    Before watching this series, I was very poor in recursion. Never understood the concepts in depth. This series helped me to fell in love with recursion. Thanks Striver.

  • @BharatVaad
    @BharatVaad 2 ปีที่แล้ว +57

    Java code for K sum subsequence :-
    void f(int ind ,int a[] ,ArrayList list, int k,int sum){
    if(ind==a.length){
    if(k==sum){
    System.out.println(list);
    }
    return ;
    }
    //take
    list.add(a[ind]);
    sum+=a[ind];
    f(ind+1,a,list,k,sum);
    list.remove(list.size() - 1);
    sum-=a[ind];
    f(ind+1,a,list,k,sum);
    }

    • @MohanaKrishnaVH
      @MohanaKrishnaVH 2 ปีที่แล้ว +8

      Few lines of adding and subtracting from the sum can be avoided by doing it as part of the function call.
      public static void subsequenceSum(int[] nums, int k) {
      subsequenceSum(nums, k, 0, new ArrayList(), 0);
      }
      private static void subsequenceSum(int[] nums, int k, int index, List subsequence, int sum) {
      if (index == nums.length) {
      if (sum == k) {
      System.out.println(subsequence);
      }
      return;
      }
      subsequence.add(nums[index]);
      subsequenceSum(nums, k, index+1, subsequence, sum + nums[index]);
      subsequence.remove(subsequence.size() - 1);
      subsequenceSum(nums, k, index+1, subsequence, sum);
      }

    • @buzunoorrishika8690
      @buzunoorrishika8690 2 ปีที่แล้ว +4

      Here can we also write as
      If ( ind==a.length && k== sum)

    • @BharatVaad
      @BharatVaad 2 ปีที่แล้ว

      @@MohanaKrishnaVH yes

    • @anmolverma075
      @anmolverma075 2 ปีที่แล้ว

      @@leetcodebaby6680 is it so?

    • @anuragkumar7710
      @anuragkumar7710 2 ปีที่แล้ว +2

      I am little confused, why we list.remove(list.size() - 1); is used instead of list.remove(a[ind]);
      Also why it gives error.

  • @mehrabrafi9496
    @mehrabrafi9496 2 ปีที่แล้ว +9

    nobody teaches me like that!! nobody ever explained me in that much deep.. best wishes my brother and Thank you for making this type of quality tutorial for free.

  • @debajyotideba5001
    @debajyotideba5001 3 ปีที่แล้ว +193

    Thanks is not enough for this GIFT , love you Dada❤️

    • @beginnertopro7265
      @beginnertopro7265 2 ปีที่แล้ว +12

      Mera bas chale to 1M like thok du😍😍

    • @parthsalat
      @parthsalat 2 ปีที่แล้ว +18

      Then GIFT him using youtube "Thanks"

  • @Entertainment-hub519
    @Entertainment-hub519 3 ปีที่แล้ว +86

    Make more videos or playlist on recursion and backtracking. I searched a lot and finally I get your videos. Your explanation is awesome, the way you teach us using dry run is amazing. Thanks a lot dada.❤️❤️🔥🙏

  • @gopalgowda9899
    @gopalgowda9899 3 หลายเดือนก่อน +2

    Excellent bro...Having studied recursion with backtracking on my own for long time always use to forget the trick.. this one stands out and there is no way we can forget the pattern... Thanks again for the effort!

  • @Lullurluli
    @Lullurluli ปีที่แล้ว +3

    I used to struggle a lot with recursion while unraveling the code, but thanks to your patient guidance and clear explanations, most of the complexities are clear to me now. I truly appreciate your willingness to help and your ability to break down complex concepts into manageable steps. Your support has been invaluable in my learning journey, and I am grateful for the progress I've made under your mentorship❤

  • @ravipatel-xu5qi
    @ravipatel-xu5qi ปีที่แล้ว +13

    wish I could find this channel earlier. No one had ever explained recursion in such a simple manner. Thank you so much.

  • @lavanya_m01
    @lavanya_m01 ปีที่แล้ว +23

    Striver your priceless contribution to the coding community will be cherished forever. This content is gold

  • @vish3933
    @vish3933 2 ปีที่แล้ว +20

    What a way of teaching striver. I am really loving recursion bcz of you🙏

  • @arindammandal1513
    @arindammandal1513 2 ปีที่แล้ว +19

    One of the best playlist to understand recursion. Thanks a lot

  • @potatocoder5090
    @potatocoder5090 2 ปีที่แล้ว +15

    Another brilliant video! The way you build concepts from the ground up is so helpful and intuitive. Thank you!

  • @shayonchakravarty4503
    @shayonchakravarty4503 2 ปีที่แล้ว +156

    i wish i have found this channel in my second year😓😓
    it feels so damn motivated to see striver bhaiya's confidence❤️

    • @ankittjindal
      @ankittjindal 2 ปีที่แล้ว +1

      kon year me ho bhaii?

    • @rameshap5254
      @rameshap5254 2 ปีที่แล้ว

      Mine too same feel 😪

    • @111rhishishranjan2
      @111rhishishranjan2 ปีที่แล้ว +2

      same bro ..now in middle of 3rd year, hope i got to know about this channel in 2nd year, last year january

    • @consistency_Is_key
      @consistency_Is_key ปีที่แล้ว +16

      me who doing this in first sem feeling proud on myself ,because hardwork never disappoints

    • @akashnaik6269
      @akashnaik6269 ปีที่แล้ว +5

      @@consistency_Is_key explore bhi karlena first year mai. baaki time bahut hai if rightly use kare toh.

  • @stith_pragya
    @stith_pragya 9 หลายเดือนก่อน +5

    UNDERSTOOD............Thank You So Much for this wonderful video...........🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻

  • @Albertrose.24
    @Albertrose.24 2 ปีที่แล้ว +43

    No other youtuber is shared...
    Thanks for all your super efforts for this wonderful video.
    Please, keep posting many such video bayya

  • @abhay9994
    @abhay9994 ปีที่แล้ว +4

    I wanted to send you a heartfelt thank you for your tireless dedication to teaching DSA for free. Your selflessness and passion for helping students with their job interview preparation have made a significant impact on my life and countless others. I am incredibly grateful for the knowledge and confidence you have imparted to us. Thank you for everything you do!❣✨✨

  • @amanpreetsinghbawa1600
    @amanpreetsinghbawa1600 2 หลายเดือนก่อน

    Just to inform how good is this guy, I watched his print all subsequences vid and attempted this one on my own and now able to solve this with the way he taught in that vid. Awesome stuff champ

  • @rishikabhati4383
    @rishikabhati4383 2 ปีที่แล้ว +4

    Absolutely Love the way you educate🔥
    May god grant you continued success. Thank you for your efforts

  • @gowreeManohar
    @gowreeManohar 2 ปีที่แล้ว +7

    printing only once technique is awesome. like i have tried to do in a contest but got wrong by not applying it in second "if" statement. superb solution sir

  • @ManishPanda-i2h
    @ManishPanda-i2h ปีที่แล้ว +1

    one of the best dsa teachers in the world. thank you Striver for your contribution to computer science education.

  • @sarth8065
    @sarth8065 ปีที่แล้ว +11

    I am amazed as well as curious about how did you learn this on your own ? Great teaching👌

  • @VinayKumar-ze2ww
    @VinayKumar-ze2ww 2 ปีที่แล้ว +6

    One of the most impressive videos of you
    Everyone should watch it, whether beginner or experienced

  • @sunilkarpe1518
    @sunilkarpe1518 2 ปีที่แล้ว +6

    Great series so far on recursion.Only thing i will recomment here is to provide a time/space complexity after solving the program.

  • @vikassharma2094
    @vikassharma2094 2 ปีที่แล้ว +2

    best video on recursion
    finally this video gave me confidence in recursion which i never got

  • @shiwamsinha7076
    @shiwamsinha7076 2 ปีที่แล้ว +3

    U r the one by which I am comfortable at programming right now

  • @rhythmjayee9707
    @rhythmjayee9707 3 ปีที่แล้ว +2

    To all who are learning recursion you all are so privileged that striver has taught all the patterns or ways by which a problem can be solved.
    When I was learning I have learned all these things by solving random recursion based Qus and lot of Tree problems.
    I highly recommend if you want to master recursion do lot of tree prblms.

    • @rhythmpatel5665
      @rhythmpatel5665 3 ปีที่แล้ว

      hello, fellow rhythm 😄

    • @dipakixj
      @dipakixj 2 ปีที่แล้ว

      @@rhythmpatel5665 😆

  • @parthsalat
    @parthsalat 2 ปีที่แล้ว +129

    Code for print all: 11:03
    Code for print one: 17:17
    Code for count: 32:38

    • @befantastic3544
      @befantastic3544 2 ปีที่แล้ว +3

      👍

    • @rohitanjane1668
      @rohitanjane1668 2 ปีที่แล้ว +3

      Thanks bro 👍🏻

    • @anonymoushackerar7507
      @anonymoushackerar7507 2 ปีที่แล้ว +2

      Thanks Bro ! Great for Revision.

    • @shivoonone1083
      @shivoonone1083 ปีที่แล้ว

      does anybody how to optimize the code for count one it's showing time limit exceeded

    • @dhananjay5053
      @dhananjay5053 ปีที่แล้ว +2

      for printing one I prefer flag wala method its ez T_T may not be optimized but still

  • @VishalYadav-nz7ie
    @VishalYadav-nz7ie ปีที่แล้ว +2

    In count subsequence problem 23:16 we can take count variable and return count variable everywhere and also in place of l and r use count

  • @TheLearningLab898
    @TheLearningLab898 2 หลายเดือนก่อน

    this one video is gem guyz, if you are not confident in recursion during interview time. just watch this video and you will be back to form.🔥

  • @FootClob
    @FootClob 11 หลายเดือนก่อน +1

    You are a legend, I don't know if you're aware how much impact you had on people like me who come from universities and colleges that fail to cover this topic

  • @prathamvardaan4187
    @prathamvardaan4187 4 หลายเดือนก่อน +1

    amazing series man the depth you are teaching is truly commendable. you covered all the possible questions that can be made on this question.

  • @aritra2374
    @aritra2374 ปีที่แล้ว +1

    The only person who could make me love and bring interest into recursion

  • @adityaroychowdhury3709
    @adityaroychowdhury3709 2 ปีที่แล้ว +6

    After this, recursion feels like such a beautiful topic

  • @AryanSingh-rizz
    @AryanSingh-rizz 11 วันที่ผ่านมา

    there is no single video in the whole internet
    this good
    Sir, O The Great Striver Sir,
    This video is just absolutely incredible in so many levels I cannot explain.
    what have you made OMG
    think about it sir
    you have literally solved all my doubts regarding recursion
    This level of knowledge is insane just Insane I cannot thank you enough 🙏🙏🙏🙏

  • @DeepakKumar-uu3qp
    @DeepakKumar-uu3qp 2 ปีที่แล้ว +1

    Bhai one thing i can say for sure that i watch more than 50 videos on recursion and i dont get much.. But now i got your channel and now i Can do any recursion questions... Thanx bhai for your explanation 🙂

  • @kaysickishere8010
    @kaysickishere8010 ปีที่แล้ว +3

    What a great video man, all my doubts and concepts of recursion have been cleared, keep up the good work.

  • @rap_like_yash
    @rap_like_yash 8 หลายเดือนก่อน +1

    00:01 Printing subsequences whose sum is k
    02:03 Understanding recursion in pattern generation
    05:57 Understanding how recursion works in building a tree.
    08:03 Recursion with pattern variations.
    12:11 Using functional methods to print one answer in recursion.
    14:21 Base case is crucial in recursion
    18:15 Understanding recursion in a code
    20:10 Understanding recursion and returning false on certain conditions
    23:48 Implementing a simple structure for counting in recursion
    25:41 Implementing recursion with count for subsequences
    29:17 Two methods failed to find any subsequence
    31:08 Understanding recursion in counting subsequences

  • @yuvrajluhach5665
    @yuvrajluhach5665 3 ปีที่แล้ว +5

    Moving to L8, Learning a lot👍 thanks for the series

  • @krishraj1942
    @krishraj1942 2 ปีที่แล้ว

    I think there is no need to pass the vector ds as pass by reference in formal argument

  • @moharramansari2594
    @moharramansari2594 2 ปีที่แล้ว +1

    Best recursion playlist on youtube history

  • @Kunalmpawar
    @Kunalmpawar 2 ปีที่แล้ว +2

    hey, striver thanks a lot man for making this series on recursion. I was not able to understand its concept and looking for a solution from last week but when I came across your channel. in just one day I understand the concept and solved 3 problems on leetcode.
    Thanks again main thanks you very much. 🙌🙌🙌🙌👏👏

  • @kuldeepaher4937
    @kuldeepaher4937 13 วันที่ผ่านมา

    Oh boiiii, i used to see all your videos but didnt understand much why ppl use to praise you so much... Today after watching this hands down bro you r the king

  • @akshitmangotra5370
    @akshitmangotra5370 2 ปีที่แล้ว +2

    Awesome bro. I literally was so dumb before your playlist. Now I am able to think, coorelate pattern and do questions.

  • @ayushijindal4898
    @ayushijindal4898 ปีที่แล้ว +5

    Took time to understand but finally understood after watching it many times
    Recursion is not easy to understand I feel it is one of the most complex concept
    But when it strike into your mind your brain automatically solve the question
    PS: To understand this video I will say first try to solve very basic recursion questions and slowly build the concept how multiple calls are made then try to watch this video several times in a month or so
    Only then I can say you can get this concept it will take time but you will get it

    • @vikassingh-ql7ef
      @vikassingh-ql7ef ปีที่แล้ว

      I still can't get recursion if anyone can tell it will be good

  • @Cool96267
    @Cool96267 3 ปีที่แล้ว +82

    Hey Striver, Could you also please attach the link of the respective leetcode questions?

    • @sanjoythakur7938
      @sanjoythakur7938 2 ปีที่แล้ว +3

      @Striver yes, this is much needed

    • @samit840
      @samit840 ปีที่แล้ว

      it is always there, since here he is just teaching concepts using his own example so not needed@@sanjoythakur7938

  • @PrakashKumar-ez7vv
    @PrakashKumar-ez7vv ปีที่แล้ว

    If i can like this video thousands times I have done that .What an explanation..

  • @tanyagupta4247
    @tanyagupta4247 2 ปีที่แล้ว +9

    Crystal clear , got all the concepts at once💖

  • @rupammondal6789
    @rupammondal6789 ปีที่แล้ว

    Just🤞🏻🤞🏻🤞🏻🤞🏻🤞🏻 how can i express..... The level of confidence you put in my body

  • @ayankhan-xh8zt
    @ayankhan-xh8zt 6 หลายเดือนก่อน

    3 patterns with the same problem which can be applied across various recursive solutions (thankyou striver 😊)

  • @gnanaphanideep6398
    @gnanaphanideep6398 2 หลายเดือนก่อน

    I just love your approach of solving the problem ❤🙌

  • @lalitbisht8381
    @lalitbisht8381 8 หลายเดือนก่อน

    Ive never sol ed subsequence problem tried it 1st time and you made it so simple

  • @angrychick7543
    @angrychick7543 ปีที่แล้ว +1

    Thanks!

  • @sonalsingh7040
    @sonalsingh7040 2 ปีที่แล้ว +1

    Recursion was never this easy... thanku raj ❤️❤️

  • @mdbayazid6837
    @mdbayazid6837 3 ปีที่แล้ว +5

    Would you please show us how to convert a loop in a recursion and vice versa? Also it would be better if you discuss about various types of recursion such as tail recursion etc.

  • @dhirajdeka3675
    @dhirajdeka3675 2 ปีที่แล้ว +2

    This is indeed the best recursion series ❤️. Thanks bhaiya ❤️

  • @Learner010
    @Learner010 2 ปีที่แล้ว +2

    Only one thing i have to say and that is Thank You.

  • @ayeshasolanki5386
    @ayeshasolanki5386 2 ปีที่แล้ว

    Not just a human, you're a brand that everyone would move to before anything else :-)

  • @keertilata20
    @keertilata20 2 ปีที่แล้ว +3

    the way you write your code without any error is so awesome

  • @thegamegoing4320
    @thegamegoing4320 6 หลายเดือนก่อน +1

    I don't usually comment but this is just beautiful explaination

  • @manishdwivedi5531
    @manishdwivedi5531 9 หลายเดือนก่อน

    23:05 you have to add a edge case that if(s>sum)return false;
    other wise it will give TLE
    overall very nice vedio bhaiya❤

  • @SagarYadav-zy5lk
    @SagarYadav-zy5lk 2 ปีที่แล้ว +2

    Hi, I am just learning recursion. I am very happy with the content. I am having a doubt at 27:31 shouldn't it be l+=print(ind+1,s,arr,n) instead of just assigning it to l. And similar for r. Hoping you will clarify my doubt.

    • @VishalGupta-xw2rp
      @VishalGupta-xw2rp 2 ปีที่แล้ว +1

      If we do l+= then we will also have to decrease its value l-=
      But by doing the way of Striver.... We don't have to worry about that because it will increase and decrease on its own

  • @deshnajain2827
    @deshnajain2827 2 ปีที่แล้ว +1

    Thank you striver, this is the best explanation I have ever seen , now I am able to correlate between different patterns of a recursion problem. Earlier I used to learn the logics but now I have started building them. Thanks for your efforts 🙂

  • @surajitdas6555
    @surajitdas6555 10 หลายเดือนก่อน

    Super useful, i wish i would have learned this way in my college days ❤

  • @ipshitatandon5134
    @ipshitatandon5134 5 หลายเดือนก่อน

    Amazing video, really helped me understand recursion patterns in depth! thank youu

  • @pritampadhan5977
    @pritampadhan5977 2 ปีที่แล้ว

    Shandaar,Chamtkaar bhaiya . DSA ka koi v topic ek banda aap se samajh nahi paya toh wo kanhi se v samajh nahi paye gaa

  • @sindhumohan1709
    @sindhumohan1709 ปีที่แล้ว

    Brilliant video, amazing content and explained in the best possible way! Thanks a lot!! Please keep helping us with continued content in the A2Z DSA course. 🖖

  • @CSBBADRIGAUTAM
    @CSBBADRIGAUTAM 2 ปีที่แล้ว

    While performing a printS() function can we use stack data structure instead of vector
    Because for me it totally looks like the vector ds is just being used for push_back() and pop_back() no more.
    Correct me if I am wrong

    • @tushargahlaut5812
      @tushargahlaut5812 2 ปีที่แล้ว +1

      But if you want to print, It will be better to use vector in place of stack.
      Otherwise Stack can also be used

  • @mohdalizilani9896
    @mohdalizilani9896 ปีที่แล้ว +1

    maja a gaya bhaiya the way explain is awesome
    and once you dry run pogram then it makes cocept crystsal clear
    thank for this beautiful lectures..😍😍

  • @gautamgrover1087
    @gautamgrover1087 ปีที่แล้ว

    Although videos are shorter but still the explaination and different patterns covers almost everything thanks

  • @aruna5869
    @aruna5869 ปีที่แล้ว

    No words to explain your teaching level❤❤💥❤‍🔥
    @23:43 laughed🤣😅

  • @ankitbansal7935
    @ankitbansal7935 ปีที่แล้ว

    Striver u are jusssst awesome , the questions which i used to take nearly hours to think , i am able to solve in minutes after watching yr series .❤

  • @zeppelinpage861
    @zeppelinpage861 2 ปีที่แล้ว +1

    Hats off to you. God bless you!!!

  • @sanchitkadwe90
    @sanchitkadwe90 2 ปีที่แล้ว

    Awesome videos bruh,totally superb.The most clear and understandable playlist ever made.Hats Off "THE STRIVER".Looking forward to more such videos.

  • @bhagyashri7729
    @bhagyashri7729 2 ปีที่แล้ว

    Could not understand pick/ non-pick logic initially and the reason for calling the same function twice. Now it's good.

  • @rishabh9714-h4v
    @rishabh9714-h4v 2 ปีที่แล้ว +2

    Thank u bhaiya 🙌❤️
    For this wonderful series on Recursion ❤️🙌

  • @abhinavs2484
    @abhinavs2484 10 หลายเดือนก่อน

    for counting sub seq: for [1,1,1] and sum = 2;
    this might not work for above scenario, since it prints answer as 3, but it s 2

  • @neerajgupta3942
    @neerajgupta3942 8 หลายเดือนก่อน

    why we need to add check of if(sum == k) inside check (ind == n), for case of returning any one subsequence, {3,1,2} we can return 3 not required to go till 2.

  • @amandixit8342
    @amandixit8342 2 ปีที่แล้ว

    thank you so much for such amazing content and teaching style ki toh baat hi na karo ek dum lit , i'm glad ki mene ye ep dekha , bahut time bachega mera :)💥

  • @akankshajain3997
    @akankshajain3997 4 หลายเดือนก่อน

    one of the best videos in the series, understood.

  • @purushottam108
    @purushottam108 6 หลายเดือนก่อน +1

    9:22 prn 🤩🤩🤩🤩 superb

  • @yash_jivrajani
    @yash_jivrajani 2 ปีที่แล้ว +2

    in JS:
    //printing sub seq whose sum is K
    // we will use take and not take
    function pick(i, a, arr) {
    if (i >= arr.length) {
    if (sumOf(a) === auxsum) console.log(a);
    return;
    }
    a.push(arr[i]);
    pick(i + 1, a, arr);
    a.pop();
    pick(i + 1, a, arr);
    }
    function sumOf(arr) {
    let sum = 0;
    for (let index = 0; index < arr.length; index++) {
    sum = sum + arr[index];
    }
    return sum;
    }
    // Driver code
    let arr = [1, 2, 3];
    let auxsum = 3;
    let path = [];
    pick(0, path, arr);

  • @tasneemayham974
    @tasneemayham974 ปีที่แล้ว

    When that add about "understanding DSA is difficult "
    But you are watching THIS LEGENDDD !🔥🔥🔥

  • @QanbarIjaz
    @QanbarIjaz 9 หลายเดือนก่อน

    Huge respect from a Pakistani 🇵🇰❤ boy.
    This series is really helpful as I'm preparing for my interviews

  • @huzefataj7694
    @huzefataj7694 2 ปีที่แล้ว +2

    Python code for K sum subsequence:
    def f(arr,i,subarray):
    if i == len(arr):
    if sum(subarray)==4:
    print(subarray)
    else:
    # include
    f(arr,i+1,subarray+[arr[i]])
    # exclude
    f(arr,i+1,subarray)

    arr=[1,2,1,2]
    f(arr,0,[])

  • @footybit
    @footybit ปีที่แล้ว

    Most fascinating thing about this it’s almost identical to a backtracking algorithm, where you have to conduct an exhaustive search to your base case/goal

  • @yaswanthkosuru
    @yaswanthkosuru ปีที่แล้ว

    i practice for around 3 months but I don't understand from Kunal Kushwaha but you make clear all concepts

    • @joya9785
      @joya9785 ปีที่แล้ว

      Not to compare Kunal explained recursion in depth about how recursive calls work and returned. After that you can understand striver's videos better

  • @aradhyapandey1489
    @aradhyapandey1489 ปีที่แล้ว

    very well explained... thank you for this amazing course!!

  • @lakithakare7387
    @lakithakare7387 3 หลายเดือนก่อน

    The count one might not work if some negative numbers are also present in the array.
    for example: [1,2,1,-1,1]

  • @thevagabond85yt
    @thevagabond85yt 26 วันที่ผ่านมา

    One Q : if you need to add i-th element before TAKE recursion and remove before calling NOT-TAKE recursion THEN Why not call the NOT-TAKE first?
    That why we only need to call add() and remove() won't be used

  • @anshikagupta5858
    @anshikagupta5858 ปีที่แล้ว

    Thankyou Striver, for this great explanation😊

  • @VaishnaviNigam
    @VaishnaviNigam 3 ปีที่แล้ว +12

    AS ALWAYS U R THE BEST AT EXPLAINING THINGS🔥🔥

  • @VINAYYADAV-tv1hp
    @VINAYYADAV-tv1hp 2 ปีที่แล้ว

    I love your videos 😀 awesome ,very awesome ,helping, Interesting, Entertaining, Full of concept from the depth .thank you bhai . Love you

  • @KarthikNandam-xs4qn
    @KarthikNandam-xs4qn 2 หลายเดือนก่อน

    17:23 at which we can simply make if (sum != currSum) we just dont need to do them nahh
    if(isum != sum){
    v.push_back(mv[i]);
    isum+=mv[i];
    PrintS(mv , v , i+1 , isum , sum , n);
    v.pop_back();
    isum-=mv[i];
    PrintS(mv , v , i+1 , isum , sum , n);
    }

  • @ForTech-rt6qi
    @ForTech-rt6qi 3 หลายเดือนก่อน

    What a session, amazing. Learned a lot. Thanks striver.