Recursion - Permutations (Theory + Code + Tips)

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

КОМЕНТАРІ • 175

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

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

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

    It you don't understand in first watch, don't skip it. See it again, you will understand. In my case i was not able to understand in my first watch , when i repeat , i got the whole thing clear

  • @PRASHANTKUMAR-il4ob
    @PRASHANTKUMAR-il4ob 2 роки тому +83

    9:30 If anyone have the confusion with brackets, kunal mistakenly used Inclusive in place of exclusive bracket and vice versa.

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

    You are a genius kunal !! 🙌

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

    bhai top class :), gazab padhaye ho, recusrsion khud se sochna aagya, Thanks alot

  • @raghavmangla2481
    @raghavmangla2481 2 роки тому +7

    Best DSA course on this planet

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

      WOW that's insane mate how many DSA courses have you taken till now?

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

    The best recursion video ever! I have been watching all your recursion videos and I can now solve recursion challenges. Looking forward to more of these. Thank you for demystifying the monster!

  • @mayanksingh6243
    @mayanksingh6243 3 роки тому +12

    Thumbnail clears that the topic which we are going to see in recursion (recurring photos) LOL
    Great work Kunal you're helping us in many ways. 😊

  • @yogpooja-vq1pp
    @yogpooja-vq1pp 2 роки тому +3

    Your content is amazing, I went through lots of DSA courses on youtube, but no video develops the understanding and solution approaching mindset as you do. Blessed that I found you.🔥🔥🔥

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

    it wouldn't hurt to leave a like. It is the least we can do for Kunal.

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

    Been following the videos daily and keeping up with them. This is very fun ngl. Great work.

  • @akaay09
    @akaay09 Рік тому +7

    People in comments are all geniuses. (excluding me)
    Most of them understood this at once.
    I personally had to rewatch is many times and draw the recursion tree on notebook few times to understand it.
    Great video Kunal.
    Recursion is like that unless u do on paper few timess u dont understand.

    • @KunalKushwaha
      @KunalKushwaha  Рік тому +6

      No one understands recursion at once, what you did is the correct way.

  • @MiddleClassBoy-lb1yi
    @MiddleClassBoy-lb1yi 4 місяці тому +2

    Logic becomes more clear after watching it again

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

    Hi Kunal,
    Your recursion playlist on UA-cam has been a game-changer for me! I have learned so much and have been able to apply the concepts in my coding projects. I would love to see a new lecture series on dynamic programming. I know it's a challenging topic, but I trust your teaching style and explanations to make it more approachable. Keep up the great work!

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

    thanks kunal before watching your i have a lots of doubts related to permutation ... after watching video ... all doubt are cleared.

  • @keepquit6925
    @keepquit6925 10 місяців тому +4

    11:45 kunal : for ( int i = o ; i < 3 ; i++) {
    System.out.println("In death");
    }
    👍👍👍👍

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

    it is no way wrong if i say your lectures are really mesmerizing....just amazing Kunal #NailediT🔥

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

    You're helping me with backtracking so much. THANK YOU!!!

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

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

    I did permutations just by seeing the previous video. Power of Kunal and recursive tree🔥🔥🔥🔥

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

    Thank you so much!!!

  • @ishumishra7472
    @ishumishra7472 3 роки тому +17

    hey Kunal can you please tell us more about how you got that 41 lac package. I am a freshman and I want to get this sort of remote job, what should I do?

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

    kunalllllllllllllllllllllllll plss make more videos your way of teaching is just fab...

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

    Thank you soo much sir, I never get this much in any videos

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

    I am jus literally clapping man😍😍😍😍

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

    You are Amazing Bro🔥🔥🔥

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

    Amazing kunal Thanks for everything😊😊

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

    Dedication levels🔝peaks

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

    Many Thanks for another great video and saving our lives 🙏

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

    i am not able to get this 0,0 + ch concept (9:00 - 10:00), can anyone explain please, i have watched thirce but sill did not get

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

      First thing to understand is how range works in substring. The code
      Substring (start index, end index)
      takes all the values from start index upto the end index-1. So for String "hello",
      Substring(0,2)
      gives "he" (i.e start index is included and end index is excluded).
      Just remember ( end index minus 1 )

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

    You are a magician Bro...❤❤❤

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

    The way you explain stuff is insane ! Thanks

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

    Thanks brother! God bless you!

  • @DipankarDas-cm1zs
    @DipankarDas-cm1zs 3 роки тому +3

    You must be maths teacher showing pattern🤯👌

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

    9:15 have u reversed the incl. excl. signs?

  • @allaboutgamimg7976
    @allaboutgamimg7976 3 роки тому +81

    You are on fire 🔥🔥🔥 bro
    The frequency of vedios 🔥🔥🔥

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

      Thank You 🙏

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

      @@KunalKushwaha Thank you for teaching these stuffs

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

      @@KunalKushwaha Please
      continue the frequency till oop ..highly needed

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

      To Everyone who's learning in Cpp or knows, The code that I've written for permutations is running infinite times. Can anyone assist me.
      #include
      using namespace std;
      void permutation(string p, string up)
      {
      if (up.empty())
      {
      cout

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

      @@twi4458 the problem is here "p = first + ch + last;
      " you are assigning the value to p again and the length of p increases with each function call and loop never breaks. Means after cba it will go like ccba, cccba, so on
      so directly pass the expression or assign it to different var such as "String ans = first + ch + last;" and it will work

  • @vasujhawar.6987
    @vasujhawar.6987 2 роки тому +4

    and why you are not monetizing your content, you are putting so much efforts teaching here on UA-cam.

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

    Amazing explanation..🙂

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

    Can u please tell till when this course will be finished ??

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

    Thanks a lot brother,your videos are helping so many people .it would be great if you could explain more examples based on permutations

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

    At 20:12 , For counting the number of permutations, instead of processing and modifying the whole string we can just take the length of the string and perform factorial using recursion approach or whatever right!?

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

    Great explanation

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

    Great man👏

  • @vasujhawar.6987
    @vasujhawar.6987 2 роки тому +4

    confusing, can improve more on teaching part, but great content. Actually I need to put lot of attention and go back understand, sort out some things myself, you speed goes insanely fast at some points. While explaining the algorithm if its something new, you can take out some time to explain the substring concept like exclusive and inclusive and how its working in the loop. i know it may get frustrating but the course teaching would be much more clean. And we will enjoy, it more. Btw thanks alot for explaining all these concepts, my thought process is building good day by day. And hope one day i will be able to crack those faagm technical interviews easily. Thanks alot.❤

  • @Karan-vq5vg
    @Karan-vq5vg 3 роки тому +5

    Congratulations for AF1 and AJ5. They look dope and u deserve it bro 👌🏻😊

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

      What are they???🙄

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

      To Everyone who's learning in Cpp or knows, The code that I've written for permutations is running infinite times. Can anyone assist me.
      #include
      using namespace std;
      void permutation(string p, string up)
      {
      if (up.empty())
      {
      cout

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

      @@twi4458 May be up.at(0) doesn;t remove the first elemrnt in unproccesed. Try adding up.substr(1) after that line

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

      @@chaitanyaprasad6924 No, real issue is I had intialised p again, rather just pass it as argument will give desired result

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

      @@kalwardin3510 shoes :p

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

    simpler better code for permutation: static void permutations(String p,String up){
    if(up.isEmpty()){
    System.out.println(p);
    return;
    }
    int n = up.length();
    for(int i =0;i

  • @ShaheenHusain-cu3qc
    @ShaheenHusain-cu3qc Рік тому

    Thank you isn't enough for this amazing content!!!!!! no words 🤐 I can't find Trees/Graphs/DP videos in this playlist or any other on your channel, are you planning to upload it any time soon? these are helping me a lot I wish I could go back in time and started with your playlist last year itself!!!!!

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

    Kunal keep the good work going mate

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

    Video 33 Completed!

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

    OOP VIDEO 🙂

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

    11:43 => How Induction motor starts ( 3idiots) 😂😂

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

    Bro the videos aare very nice but plz try to increase the frequency... Plz

  • @AyushAnand-qb8ke
    @AyushAnand-qb8ke 10 місяців тому

    respect to you bhaiya

  • @RaviPatel-rj1re
    @RaviPatel-rj1re 3 роки тому +1

    hello kunal sir, when u going to start the oops video

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

    9:27 seems little confusing regarding inclusive and exclusive..

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

    still watching consistently
    😀😀😀

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

    thanks kunal

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

    Please cover Kth permutation question
    Mostly asked

  • @jk-sm6qr
    @jk-sm6qr Рік тому

    Thanks dude

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

    Does the time complexity of permutations is n* n^n(no.of levels * time taken at each level)?

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

    Which code editor do you use

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

    I can understand your logic what you are telling but unable to solve questions by own .PLEASE start making series of leetcode questions .

  • @keshav-ip7vx
    @keshav-ip7vx 2 роки тому +1

    Hi Kunal can you please explain unique permutations with duplicates element I tried many times but I enable to map unique permutation logic with explained by your logic or can you just give me any hint.

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

    Kunal, here is O(n) solution for permutation count -
    int pc( str )
    {
    if ( str is empty ) return 0;
    if( str.length() == 1) return 1;
    int original_len = str.length();
    int rem_len = pc( str.substring(1) );
    return ( original_len * rem_len );
    }
    I am building my thought process ... thanks!!! ❤️❤️✔️

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

    complete your dsa bootcamp please

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

    @Kunal Kushwaha can you tell us who is your guru. how did you teach your self DS Algo so well!

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

    please explain frequency array and frequency string.... I mean please make a video on these

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

    Permutation code:
    import java.util.*;
    public class Main
    {
    public static void main(String[] args) {
    String s="abcd";
    ArrayList ans=permute(s,"");
    for(int i=0;i

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

    Kunal mujhe internship ke liye apply krna hai pr yeh smhj nhi aarha ki skills mai kya likhu maine yeh course shuru se abhi tk full follow kiya is course ke basis pr kuch skill likh saku mai 🥺 plz reply

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

      Same

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

      Hii Naman
      How's this course
      M new in programming
      Should I follow? Also m a medicore student

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

    Thanks.😀 please do not delete these videos later.

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

    You are using substring fxn...an extra overhead...explain with swaping metthod

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

    hey kk can we use for loop inside a recursion function or not or why we are using loop in permutation question otherwise it will not a recursion based question

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

      i already explained this. we use it when we dont have fixed amount of calls.

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

    @KunalKushwaha please complete your course

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

    Hello
    Please cover collections programs in this DSA course please I want to learn different programs on that topics

  • @riya-xr3gk
    @riya-xr3gk Рік тому +1

    You explain a lot about how you have taught a particular concept earlier and that you wont explain it again. okay I get it just prob refer the video in which you have taught that concept for ppl who prob havent watched all your videos. Dont everytime say that you have explained it earlier and it entire story it becomes annoying.(Just a suggestion)
    PS: your teaching is amazing it is helping me a lot, thanks!

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

    can u please do this for a non-repeating string🙏?

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

    It seems that permutation of strings are trivial in comparison to a list of Integers. How can we go about doing permutation of a list of integers?

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

      # Permutations
      ```python
      class Solution:
      def permute(self, nums: List[int]) -> List[List[int]]:
      available_items = nums.copy()
      self.final_ans = []
      current_path = []
      self.N = len(nums)
      self.backtracking(available_items,current_path)
      return self.final_ans
      def backtracking(self,available_items,current_path):
      if len(current_path) == self.N:
      self.final_ans.append(current_path)
      for i in range(len(available_items)):
      # current_path.append(available_items.pop(i))
      # self.backtracking(available_items,current_path)
      # available_items.insert(i,current_path.pop())
      self.backtracking(available_items[:i]+available_items[i+1:],current_path+[available_items[i]])
      ```

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

    I love ur video

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

    Thanks bro

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

    Do you have JacaScript course?

  • @MrAman-zj6xi
    @MrAman-zj6xi 2 роки тому

    Trees ki videos kab aaengi ?

  • @chhayanshubhanage6152
    @chhayanshubhanage6152 2 місяці тому

    I have a doubt.
    static ArrayList allPermutations(String s, String us) {
    ArrayList list = new ArrayList();
    if (us.isEmpty()) {
    list.add(s); // Base case: print the permutation
    }
    else
    {
    char ch = us.charAt(0);
    for (int i = 0; i

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

    Can someone explain/or give the code for passing count inside the argument ??

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

    At 15:32.... I'm like LOL

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

      dude went brrrerwrewarrew...

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

    The permutations for string you explained is so great. But it seems like this approach doesn't go well for permutations of array. No video on permutations of array is getting into my head. Can you make one or send me a code

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

    please upload dp videos soon

  • @ManojManoj-lx5rc
    @ManojManoj-lx5rc 8 місяців тому

    17:41 anyone explain

  • @keshav-ip7vx
    @keshav-ip7vx 2 роки тому +1

    Any one who want C++ soltuion 👇👇👇
    void stringPermutation(string &s, string t, int i,vector &vs)
    {
    if(i==s.size())
    {
    vs.push_back(t);
    return;
    }
    for(int j=0; j

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

    hey kunal, please start OOPs next

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

    Bro plz all java + dsa handwritten notes upload in github or drive

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

    nice

  • @MohammedRoshan-b8w
    @MohammedRoshan-b8w 3 місяці тому

    There is no graphs in this course?

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

    --Ignore --
    Iterative way will be covered later .

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

    What will be the complexity of this?

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

    after completing this coarse am is any need do any other things

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

    love this XD 15:31

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

    I am not getting Impatient just curious to know when OOPs will start

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

    Does anyone how can we modify the code for duplicates?

  • @BhojpuriyaRajaji3
    @BhojpuriyaRajaji3 10 місяців тому

    hello bahiya you will write a code of premutation this is :
    static void permutation(String p,String up) {
    if(up.isEmpty()) {
    System.out.print(p);
    return;
    }
    char ch=up.charAt(0);
    for(int i=0;i

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

    Amazingly and feels Effortless!!!