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

Sdílet
Vložit
  • čas přidán 8. 07. 2024
  • Check our Website:
    In case you are thinking to buy courses, please check below:
    Link to get 20% additional Discount at Coding Ninjas: bit.ly/3wE5aHx
    Code "takeuforward" for 15% off at GFG: practice.geeksforgeeks.org/co...
    Code "takeuforward" for 20% off on sys-design: get.interviewready.io?_aff=takeuforward
    Crypto, I use the Wazirx app: wazirx.com/invite/xexnpc4u
    Take 750 rs free Amazon Stock from me: indmoney.onelink.me/RmHC/idje...
    Earn 100 rs by making a Grow Account for investing: app.groww.in/v3cO/8hu879t0
    Linkedin/Instagram/Telegram: linktr.ee/takeUforward
    ---------------------------------------------------------------------------------------------------------------------------------------------------- Please check out the entire channel for other sets of series on tougher and complex topics. Also do consider subscribing :)
    Please check out the SDE sheet which the entire country is using and getting placed at top-notch companies: takeuforward.org/interviews/s...
    Checkout Striver's Handles: linktr.ee/takeUforward

Komentáře • 582

  • @manavpatnaik222
    @manavpatnaik222 Před 3 měsíci +28

    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!

  • @VishalGupta-xw2rp
    @VishalGupta-xw2rp Před rokem +174

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

  • @manashroy9469
    @manashroy9469 Před rokem +57

    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 Před rokem +6

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

    • @rkdhillon8450
      @rkdhillon8450 Před měsícem

      @@dtu-emgeenear3274 what's your status?

    • @Maverick-vu9kl
      @Maverick-vu9kl Před 3 dny

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

  • @debajyotideba5001
    @debajyotideba5001 Před 2 lety +158

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

  • @BharatVaad
    @BharatVaad Před 2 lety +51

    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 Před 2 lety +7

      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 Před rokem +4

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

    • @BharatVaad
      @BharatVaad Před rokem

      @@MohanaKrishnaVH yes

    • @anmolverma075
      @anmolverma075 Před rokem

      @@leetcodebaby6680 is it so?

    • @anuragkumar7710
      @anuragkumar7710 Před rokem +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.

  • @parthsalat
    @parthsalat Před 2 lety +126

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

  • @pralhadmule677
    @pralhadmule677 Před 3 měsíci +13

    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 CZcams for free. Hats off to this man! 💕🔥🙏

  • @adityakumar-sp4ki
    @adityakumar-sp4ki Před rokem +16

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

  • @Entertainment-hub519
    @Entertainment-hub519 Před 2 lety +82

    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.❤️❤️🔥🙏

  • @shayonchakravarty4503
    @shayonchakravarty4503 Před 2 lety +146

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

    • @ankittjindal
      @ankittjindal Před rokem +1

      kon year me ho bhaii?

    • @rameshap5254
      @rameshap5254 Před rokem

      Mine too same feel 😪

    • @111rhishishranjan2
      @111rhishishranjan2 Před rokem +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 Před rokem +14

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

    • @akashnaik6269
      @akashnaik6269 Před rokem +4

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

  • @arindammandal1513
    @arindammandal1513 Před 2 lety +18

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

  • @potatocoder5090
    @potatocoder5090 Před 2 lety +15

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

  • @lavanyam3224
    @lavanyam3224 Před 9 měsíci +22

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

  • @rabbanimunna6992
    @rabbanimunna6992 Před rokem +7

    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.

  • @vish3933
    @vish3933 Před 2 lety +19

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

  • @abhay9994
    @abhay9994 Před 7 měsíci +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!❣✨✨

  • @gowreeManohar
    @gowreeManohar Před 2 lety +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

  • @mehrabrafi9496
    @mehrabrafi9496 Před rokem +7

    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.

  • @skyd8551
    @skyd8551 Před 11 měsíci +2

    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❤

  • @vikassharma2094
    @vikassharma2094 Před 2 lety +2

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

  • @VinayKumar-ze2ww
    @VinayKumar-ze2ww Před 2 lety +5

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

  • @shiwamsinha7076
    @shiwamsinha7076 Před 2 lety +3

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

  • @adityaroychowdhury3709
    @adityaroychowdhury3709 Před rokem +6

    After this, recursion feels like such a beautiful topic

  • @yuvrajluhach5665
    @yuvrajluhach5665 Před 2 lety +5

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

  • @DeepakKumar-uu3qp
    @DeepakKumar-uu3qp Před 2 lety +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 🙂

  • @VaishnaviNigam
    @VaishnaviNigam Před 2 lety +12

    AS ALWAYS U R THE BEST AT EXPLAINING THINGS🔥🔥

  • @stith_pragya
    @stith_pragya Před 3 měsíci +4

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

  • @dhirajdeka3675
    @dhirajdeka3675 Před 2 lety +2

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

  • @ravipatel-xu5qi
    @ravipatel-xu5qi Před 11 měsíci +11

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

  • @Kunalmpawar
    @Kunalmpawar Před 2 lety

    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. 🙌🙌🙌🙌👏👏

  • @rishikabhati4383
    @rishikabhati4383 Před rokem +1

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

  • @kaysickishere8010
    @kaysickishere8010 Před rokem +3

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

  • @sunilkarpe1518
    @sunilkarpe1518 Před rokem +5

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

  • @moharramansari2594
    @moharramansari2594 Před 2 lety +1

    Best recursion playlist on youtube history

  • @sarth8065
    @sarth8065 Před 10 měsíci +9

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

  • @sanchitkadwe90
    @sanchitkadwe90 Před 2 lety

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

  • @akshitmangotra5370
    @akshitmangotra5370 Před rokem +2

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

  • @zeppelinpage861
    @zeppelinpage861 Před rokem +1

    Hats off to you. God bless you!!!

  • @ishamohit3251
    @ishamohit3251 Před 2 lety

    Thank you so much Striver for your videos and all your help.

  • @rishabhpandey9714
    @rishabhpandey9714 Před 2 lety +2

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

  • @rishavsingh5568
    @rishavsingh5568 Před 2 lety

    This is what crystal clear teaching is

  • @abhikmandal8746
    @abhikmandal8746 Před 2 lety

    Thank You So Much..I really love this explanation..

  • @Cool96267
    @Cool96267 Před 2 lety +81

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

    • @sanjoythakur7938
      @sanjoythakur7938 Před rokem +3

      @Striver yes, this is much needed

    • @samit840
      @samit840 Před 8 měsíci

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

  • @user-vu5jj8ki9t
    @user-vu5jj8ki9t Před 6 měsíci +1

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

  • @manasranjanmahapatra3729

    All clear now. Thanks bro for creating such amazing videos💥.

  • @yashhokte1020
    @yashhokte1020 Před rokem

    Hats off to you man !! May god bless you always 😇

  • @amandixit8342
    @amandixit8342 Před 2 lety

    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 :)💥

  • @jaiminsolanki5478
    @jaiminsolanki5478 Před 2 lety

    Understood all patterns, tysm brother!

  • @lalitbisht8381
    @lalitbisht8381 Před 2 měsíci

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

  • @mdbayazid6837
    @mdbayazid6837 Před 2 lety +4

    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.

  • @mdyousufgazi4030
    @mdyousufgazi4030 Před rokem

    this lecture is like magic. just amazing

  • @VishalYadav-nz7ie
    @VishalYadav-nz7ie Před 7 měsíci +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

  • @yashstudio7396
    @yashstudio7396 Před rokem

    Really thankful to this man amazing explanation ❤❤

  • @sonalsingh7040
    @sonalsingh7040 Před 2 lety +1

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

  • @aritra2374
    @aritra2374 Před 6 měsíci +1

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

  • @krishraj1942
    @krishraj1942 Před 2 lety

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

  • @tee_vee1121
    @tee_vee1121 Před 2 lety +1

    learning to create the tree is very important to understand recurssion!!!

  • @gautamgrover1087
    @gautamgrover1087 Před rokem

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

  • @radharamamohanakunnattur3035

    Understood and awesome explanations!!

  • @Sarkar.editsz
    @Sarkar.editsz Před rokem

    Thanks a lot , great teaching , thank you sir

  • @shubh13799
    @shubh13799 Před 2 lety +2

    Amazing concepts here, a must watch.

  • @spytonic4171
    @spytonic4171 Před 2 lety

    you are just amazing bro you are a gem to the community

  • @RoadsInCanada
    @RoadsInCanada Před 2 lety

    Best backtracking playlist. Thanks a lot.

  • @PrakashKumar-ez7vv
    @PrakashKumar-ez7vv Před 11 měsíci

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

  • @sindhumohan1709
    @sindhumohan1709 Před rokem

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

  • @AnkitKumar-tn4hm
    @AnkitKumar-tn4hm Před rokem

    Thank you, sir,
    for such a great explanation.

  • @kumarsunny4358
    @kumarsunny4358 Před 2 lety

    Beautifully explained👌

  • @paullater6230
    @paullater6230 Před měsícem

    Incredible!! Brilliant Explanation!!! Thanks a lottt!

  • @aradhyapandey1489
    @aradhyapandey1489 Před rokem

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

  • @Learner010
    @Learner010 Před 2 lety +2

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

  • @kartiksuman9814
    @kartiksuman9814 Před 2 lety

    Awesome content...Really helped me. Thankyou bhaiya

  • @FootClob
    @FootClob Před 6 měsíci +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

  • @philosphize
    @philosphize Před rokem

    Thanks Man, Got the doubt clear. Was amazing tutorial

  • @VINAYYADAV-tv1hp
    @VINAYYADAV-tv1hp Před 2 lety

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

  • @ankitbansal7935
    @ankitbansal7935 Před 9 měsíci

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

  • @Albertrose.24
    @Albertrose.24 Před 2 lety +43

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

  • @-BIT-vaishali
    @-BIT-vaishali Před 2 lety

    Understood evry thing crystal clear

  • @singhsahab9478
    @singhsahab9478 Před 2 lety +1

    I can see the hard work of your

  • @jinhuang7258
    @jinhuang7258 Před rokem

    This is a brilliant video. Thank you!

  • @sahilanand30
    @sahilanand30 Před 2 lety +3

    Sir u r my inspiration 🔥

  • @sukritinarang5016
    @sukritinarang5016 Před 2 lety

    Thanks for the awesome lecture !

  • @rupammondal6789
    @rupammondal6789 Před rokem

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

  • @adityavaste8963
    @adityavaste8963 Před 9 měsíci

    Very insightful, thanks striver for this.

  • @nikeshmali8506
    @nikeshmali8506 Před rokem

    this was beautiful, thanks for this video

  • @kvv6452
    @kvv6452 Před 2 lety

    Understanding simplified.

  • @tanyagupta4247
    @tanyagupta4247 Před rokem +9

    Crystal clear , got all the concepts at once💖

  • @thegamegoing4320
    @thegamegoing4320 Před 16 dny +1

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

  • @surajitdas6555
    @surajitdas6555 Před 5 měsíci

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

  • @anshikagupta5858
    @anshikagupta5858 Před 7 měsíci

    Thankyou Striver, for this great explanation😊

  • @user-vz8rb6ch4p
    @user-vz8rb6ch4p Před 4 měsíci

    what an explanation ! thank you so much

  • @kayveekhatrao2486
    @kayveekhatrao2486 Před rokem

    thank for such simple explanation.

  • @ayankhan-xh8zt
    @ayankhan-xh8zt Před měsícem

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

  • @jasmeenkaur6001
    @jasmeenkaur6001 Před 2 lety

    ur explanation is best bhaiya in this entire youtubee.... thanksss alottttttttttttttttttttttttttttttttttttt .. god bless uu ..

  • @KomalKanwarRathore-oy3yv

    u explain very well thanks for the videos.

  • @Rajat_maurya
    @Rajat_maurya Před 2 lety

    bhai dilse sukriya akpa...bhagwan apko hardam khush rakhe

  • @shiwamsinha7076
    @shiwamsinha7076 Před 2 lety +1

    u r the best sir thanks a lot

  • @sumitsatpute8906
    @sumitsatpute8906 Před rokem

    This is just THE BEST.
    I don't have anything to add.

  • @footybit
    @footybit Před 10 měsíci

    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

  • @ayeshasolanki5386
    @ayeshasolanki5386 Před 2 lety

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

  • @aadarshdixitiitroorkee7596

    Great 👍 ,you are best as always