Friends Pairing Problem Dynamic Programming | Explanation with Code

Sdílet
Vložit
  • čas přidán 5. 08. 2020
  • Please consume this content on nados.pepcoding.com for a richer experience. It is necessary to solve the questions while watching videos, nados.pepcoding.com enables that.
    NADOS also enables doubt support, career opportunities and contests besides free of charge content for learning. In this video, we discuss the Friends Pairing problem where we are required to print the number of ways in which n friends can pair up where each person has two options, either to pair up or to stay single. In this problem,
    1. You are given a number n, representing the number of friends.
    2. Each friend can stay single or pair up with any of it's friends.
    3. You are required to print the number of ways in which these friends can stay single or pair up.
    E.g.
    1 person can stay single or pair up in 1 way.
    2 people can stay singles or pair up in 2 ways. 12 = 1-2, 12.
    3 people (123) can stay singles or pair up in 4 ways. 123 = 1-2-3, 12-3, 13-2, 23-1.
    To attempt and submit this question, click here: www.pepcoding.com/resources/o...
    For a better experience and more exercises, VISIT: www.pepcoding.com/resources/o...
    #dp #dynamicprogramming
    Have a look at our result: www.pepcoding.com/placements
    Follow us on our FB page: / pepcoding
    Follow us on Instagram: / pepcoding
    Follow us on LinkedIn: / pepcoding-education

Komentáře • 155

  • @AKASH-sw9bs
    @AKASH-sw9bs Před 3 lety +44

    That's why you Don't have any dislike.... Noobs to advance level programmers all will understand your explanation.
    Amazing sir 🙏

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

      Glad you liked it!! keep watching and share among your peers

    • @atrijpaul4009
      @atrijpaul4009 Před 2 lety

      Absolutely true. Explanation for everyone

  • @algodextrous
    @algodextrous Před 2 lety +13

    I m glad that I have solved this question by only watching the first 3 minutes of the video, these videos are helping me alot

  • @babbarimam2058
    @babbarimam2058 Před 2 lety

    Thanks for your videos....Amazing simple explanation to complex problems!

  • @manashroy9469
    @manashroy9469 Před rokem +1

    I tried a lot to think about it. But I didn't. Finally I got this video. And finally I got it. Thank you so much. Most of the CZcamsrs were unable to make this concept understandable. Thank you so much❣️

  • @Abhay.Bhandari
    @Abhay.Bhandari Před rokem

    Best explanation found on CZcams

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

    Thankyou so much Sumit sir , great solution

  • @aashishsah2110
    @aashishsah2110 Před 2 lety

    aweswome explanation sir!!!!

  • @kamilsingh3700
    @kamilsingh3700 Před 3 lety +5

    Although i understood ,ur explaination in the first go, but still watched all repeated explaination,even from every angle and insights, salute for your extra enthusiasm in teaching....thank u for outstanding explaination.....

    • @Pepcoding
      @Pepcoding  Před 3 lety

      I am glad you liked it. I also hope that you are watching till end and trying to understand the what, how and especially why of the problem.
      If you like our efforts, we request a review
      g.page/Pepcoding/review?rc
      You can subscribe to our channel here
      czcams.com/users/Pepcodingabout?view_as=subscriber

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

    Thanks for explaining why we should not take NC2 in the formula, i have seen numerous channels explaining how to solve and stop. You are going one step ahead and explain the common misconceptions/ mistakes students do. Thank you for going the extra mile.

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

      Glad you liked it!
      For better experience, visit nados.pepcoding.com, where you will get well curated content and career opportunities.

  • @rajiv-59
    @rajiv-59 Před 2 lety +1

    wow great explainatation sir ........................a beginner student can also understand your teaching methodology.................

  • @unknownuserfound9968
    @unknownuserfound9968 Před 3 lety

    Too good as always ❤️👍...

  • @pragatiagrawal3599
    @pragatiagrawal3599 Před 3 lety

    One of the best explanations ever.... Wow!! Thanks a lot sir

    • @Pepcoding
      @Pepcoding  Před 3 lety +1

      I am glad you liked it. I also hope that you are watching till end and trying to understand the what, how and especially why of the problem.
      If you like our efforts, we request a review
      g.page/Pepcoding/review?rc
      You can subscribe to our channel here
      czcams.com/users/Pepcodingabout?view_as=subscriber

  • @ArpitSharma3107
    @ArpitSharma3107 Před 3 lety

    Great job. Smooth to understand. :)

    • @Pepcoding
      @Pepcoding  Před 3 lety

      yahi to chaie
      If you like our efforts, we request a review
      g.page/Pepcoding/review?rc
      You can subscribe to our channel here
      czcams.com/users/Pepcodingabout?view_as=subscriber
      For clearing your doubts, you can join our community on telegram
      t.me/pepcoding

  • @shubhamvora7237
    @shubhamvora7237 Před 2 lety

    Bettern explanation than GFG. I came here from GFG. Thanks!

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

    Thank you so much for your amazing explaination sir.

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Thankyou beta,
      I am glad you liked it. I also hope that you are watching till end.
      If you like our efforts, will you like to write a few words about us here (www.quora.com/How-do-I-start-learning-or-strengthen-my-knowledge-of-data-structures-and-algorithms )

  • @rishabhgoyal2835
    @rishabhgoyal2835 Před 3 lety

    next level insights mile isme to .. ,much thanks : )

  • @prakharagarwal4933
    @prakharagarwal4933 Před 3 lety

    kitni baar samjhate h ek cheez ko...it show your dedication...thanks alot sir

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Thankyou beta!
      I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem.
      If you like our efforts, will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

  • @aakashKumbhare
    @aakashKumbhare Před 3 lety

    i liked the part where in some solution doesnt work and why they dont work.. It gives me more insight as to what i should not do.. and this is what most of the question required..
    Thank you

  • @ujjwalyadav5898
    @ujjwalyadav5898 Před 2 lety

    Nice explanation 🔥🔥🔥

  • @NavneetKumar-fr9wj
    @NavneetKumar-fr9wj Před rokem

    Mast smjhaya teacher

  • @nikhilksvlogs
    @nikhilksvlogs Před 2 lety

    nice explanation

  • @hrushikeshkamurthi5721

    kya bhaval padate ho sir ji !! very interesting was the second part of explanation of why other approach is wrong . sir please is further videos i request you to come up with more such failure cases .

  • @shauryapratapsingh4959

    thank you sir

  • @nitinkumar5974
    @nitinkumar5974 Před 3 lety +1

    Awesome sir 🔥🔥🔥🔥🔥
    maa kasam apni poori life mai iss tareh se hindi mai explanation nahi dekha.
    mann toh kar raha hai ki aapki saari videos aaj hi dekh loo
    khusi bayan nahi kar sakta .....Thanku Thanku So much sumit sir.

    • @Pepcoding
      @Pepcoding  Před 3 lety

      wow, this cheers me up. I am glad we at pepcoding could be of help to you. Keep learning. Also, recommend us to your juniors and peers, they may also benefit.

  • @sainathreddy2632
    @sainathreddy2632 Před 3 lety

    U R A REAL PEPCODER :)

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Thankyou!
      If you like our efforts, will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

  • @anirudhatalmale5575
    @anirudhatalmale5575 Před 3 lety

    The best explanation

    • @Pepcoding
      @Pepcoding  Před 3 lety

      I am glad you liked it. I also hope that you are watching till end and trying to understand the what, how and especially why of the problem.
      If you like my efforts, I request a review
      g.page/Pepcoding/review?rc

  • @sankaruma8810
    @sankaruma8810 Před 3 lety

    I don't know hindi
    But i understood the logic
    That much ur explanation is..
    Thank u so much

    • @Pepcoding
      @Pepcoding  Před 3 lety +1

      Thanks Buddy!
      I am glad you liked it. I also hope that you are watching till the end and trying to understand the what, how, and especially why of the problem. If you like our efforts, will you like to review us here - g.page/Pepcoding/review?rc
      Also, I would like to inform that soon we are going to start the same content in english also.

  • @lokeshojha1542
    @lokeshojha1542 Před 3 lety

    wow.. amazing explanation .. ek baar mein samajh aa gaya .. sir make videos on daily challanges .. like leetcode monthly challange....

    • @Pepcoding
      @Pepcoding  Před 3 lety

      beta oct 30 ke baad bnaunga. Tab tak leetcode level ke normal list planned hai ek

  • @sarthakgaba1583
    @sarthakgaba1583 Před 3 lety +1

    Thank you :)

  • @atefnazi753
    @atefnazi753 Před 2 lety

    you may also make videos in english as there is many audiences those who don't understand hindi properly...by the way a great explanation

  • @pradeepmondal4943
    @pradeepmondal4943 Před 3 lety +5

    Accidentally i solved this question , and accidentally i got the formula also ,
    Now , after seeing this video , understood that formula 😂😂😂..
    Thank you sir...

    • @pluviophile762
      @pluviophile762 Před 3 lety

      ya same happened with me also 😅

    • @Pepcoding
      @Pepcoding  Před 3 lety +7

      Aise he lage rho beta, phle khud he koshish krni chaheye beta, but jab thak jao soch soch k aur solution na smj aaye tab fr le lo help solution video ki

    • @pluviophile762
      @pluviophile762 Před 3 lety +1

      @@Pepcoding yes sir you are absolutely right, thanks for all your efforts and great explanation of these videos, more power to you sir 🙂

  • @BhanuPrakash-ni2un
    @BhanuPrakash-ni2un Před 3 lety

    Bhai, it's awesome

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Thankyou beta!
      I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem.
      If you like our efforts, will you like to write a few words about us here (www.quora.com/How-do-I-start-learning-or-strengthen-my-knowledge-of-data-structures-and-algorithms )
      Keep learning and keep loving Pepcoding😊

  • @southern-sunshine
    @southern-sunshine Před 3 lety +1

    standing ovation from me....legend level explaination

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Glad to know that you liked the content and thank you for appreciating.
      The love and respect which I get from you people keep me highly motivated and the same I am able to forward It to you people through my videos.
      So, keep motivating, keep learning and keep loving Pepcoding😊

    • @AshishKumar-kh3ik
      @AshishKumar-kh3ik Před 3 lety

      @@Pepcoding best videos on ds algo on youtube..pranam swikar kare sir

    • @AshishKumar-kh3ik
      @AshishKumar-kh3ik Před 3 lety

      @@Pepcoding sir ek crash course series v laye

  • @nuamaaniqbal6373
    @nuamaaniqbal6373 Před 2 lety

    class!!

    • @Pepcoding
      @Pepcoding  Před 2 lety

      For better experience and curated content sign up on nados.io and post your queries on community tab of NADOS.

  • @gamersgame43
    @gamersgame43 Před rokem

    can there be one variationn of this problem where we add the condition of having 3 groups also with single and paired groups
    and also what could be the recurrence relation?

  • @funwithfoooood6749
    @funwithfoooood6749 Před 2 lety

    Wow after watching this, I realise how easy it was and how difficult I made it.

  • @amitpatil9258
    @amitpatil9258 Před 3 lety

    Thanks sir..

  • @yashtailor6773
    @yashtailor6773 Před 3 lety

    Amazing explanation.. 5th grade ke bacche bhi samaj jayenge 😍

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Glad to know that you liked the content and thank you for appreciating.
      The love and respect which I get from you people keep me highly motivated and the same I am able to forward It to you people through my videos.
      So, keep motivating, keep learning and keep loving Pepcoding😊

  • @nikhilkhanna8685
    @nikhilkhanna8685 Před 3 lety

    Sir can this be done in O(1) , in such a manner that when we are given n we just insert it in an equation and get the final answer as we already know what series it will follow.

  • @ankitparashar8730
    @ankitparashar8730 Před 3 lety

    Great explanation

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Glad it was helpful! and If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

  • @anjneykumarsingh4461
    @anjneykumarsingh4461 Před 3 lety

    Ye doubt aya .Apne solve kr diya

  • @akshayraj2534
    @akshayraj2534 Před rokem

  • @PiyushKumar-ix9jp
    @PiyushKumar-ix9jp Před 3 lety

    sir it will not pass the case when n=100000 ,i have given long dataType but still getting 0 as my output

  • @zaid4you256
    @zaid4you256 Před 3 lety

    sir tiles M*1 ques me problem hai
    why dp of size n+1 not m+1

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

    when is sumeet sir coming back. also will he be teaching in the NADOS program. please help @Pepcoding

  • @sameer1571
    @sameer1571 Před 3 lety

    Literally bro kaya samjhaya hai maaza aa gaya aisa mainey apne paid courses me samjha tha aapne uss se bhi upar wale level ka samjha dala 🔥🔥🔥

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

    Sir after foundation can you parallely start levelup recursion and Interview prep arrays+strings. Since foundation + array string of IP would be helpfull for us to crack small product based companies. Otherwise it will take time to start with arrays after levelup.

    • @Pepcoding
      @Pepcoding  Před 4 lety +1

      Will do it in parallel bro.

  • @agamjain8976
    @agamjain8976 Před 3 lety

    Nice explanation

  • @ambadassanjukumar3329
    @ambadassanjukumar3329 Před 3 lety +1

    Find Largest Area
    Given you a box which is separated by line, both horizontally and vertically. Imagine there are n
    lines present vertically and m lines are there horizontally (every box created by the lines are 1
    unit). Now you have been told to remove some lines from horizontal and vertical. You have to
    calculate the largest box created after the changes.
    Sample Input:
    n=5
    m=5
    h=[2]
    v=[2,3,5]
    Output:
    6

  • @rexstark5319
    @rexstark5319 Před 3 lety

    Nice

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Thanks and If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

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

    Awesome explaination sir🙏

    • @Pepcoding
      @Pepcoding  Před 4 lety +1

      Thanks and welcome. Please share and subscribe as well.

    • @Pepcoding
      @Pepcoding  Před 4 lety +1

      Thanks for liking the content, I request you could write about our channel on your facebook or linkedin? So that maximum students could get the best out of it.

    • @rahulbhatia3075
      @rahulbhatia3075 Před 4 lety

      Ok sir,I will

    • @rahulbhatia3075
      @rahulbhatia3075 Před 4 lety

      Done sir

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

    lajavab

  • @akhile2475
    @akhile2475 Před 3 lety

    Awesome

    • @Pepcoding
      @Pepcoding  Před 3 lety +1

      If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

    • @akhile2475
      @akhile2475 Před 3 lety

      @@Pepcoding sure 🙂

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

    sir does dynamic programming focus only on counting the number of cases and not exactly getting those cases ?

    • @Pepcoding
      @Pepcoding  Před 4 lety +6

      Aisa nahi hai. Extended question hota hai jisme case bhi btana hota hai. DP + Graphs se hoga. Hum krenge.

  • @ShivamKumar-cv7jv
    @ShivamKumar-cv7jv Před 3 lety

    your video force me to give a thumbs up.

    • @Pepcoding
      @Pepcoding  Před 3 lety +1

      Keep watching and keep loving Pepcoding😊
      If you like our efforts, will you like to write a few words about us here (www.quora.com/How-do-I-start-learning-or-strengthen-my-knowledge-of-data-structures-and-algorithms )

    • @ShivamKumar-cv7jv
      @ShivamKumar-cv7jv Před 3 lety +1

      @@Pepcoding I love to.

  • @ayushgoel9584
    @ayushgoel9584 Před 4 lety +1

    Bhaiya 1 video , for loops and nested for loops ki time complexity pe bna dijiye

    • @Pepcoding
      @Pepcoding  Před 4 lety

      bro, time and space mei abhi 10 videos aur daalni hain.

  • @rahulbhatia3075
    @rahulbhatia3075 Před 4 lety +1

    Sir pls make video on N/3 repeated number in an array with O(1) space

  • @HimanshuSingh-ob9qo
    @HimanshuSingh-ob9qo Před 3 lety

    👌

  • @kanhamishra1630
    @kanhamishra1630 Před 4 lety +15

    Sir.. If you please increase duration of video.. to say 40-45 minutes.. in dynamic programming. It will become most helpful.. as recursion then memorisation then tabulation.. It will be most helpful...

    • @Pepcoding
      @Pepcoding  Před 4 lety +11

      beta dp via recursion alag se karunga.

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

    I did is slightly different.
    public static int friendsPairing(int n) {
    int single = 1;
    int pair = 0;
    for(int i=2;i

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

      submit it and see if all the test case pass else rfer this solution
      int single = 1;
      int pairUp = 1;
      int ans = 0;
      for (int i = 2; i

    • @amandixit3555
      @amandixit3555 Před 3 lety +1

      you have done right , har ek banda kitne tareeko se single raha sakta hai is , kitne tareeko se baki bache log pair up ya single rah sakten hain, . ab ek banda kitne tareeko se pair up kar sakta hai is ki voh kisi bhi ek bande ko pakad le aur pair up hojaye , aur ab baki bache n-2 log kitne tareeko se pair up ya single rahne ka game khel sakten hain.
      public static int friendsPairing(int n) {
      int a = 1; // i have stored the number of ways 1 person can remain single or pair up
      int b = 2; // i have stored the number of ways 2 person can remain single or pair up
      int total=0 // total no of ways i th person can remain simgle or pair up
      for(int i=3;i

  • @akshaykumarmalathkar2968

    In the question constraint is given as 0

  • @utkarshverma2604
    @utkarshverma2604 Před 2 lety

    sumit sir is god

  • @ishanpatni2684
    @ishanpatni2684 Před 3 lety +1

    sir aap bata rahe the ki dp via tabulation is better than recursion...why?@PepCoding

    • @Pepcoding
      @Pepcoding  Před 3 lety +1

      kyunki isme aapko topological sort sochna padta hai aur memoization mei nahi sochna padta. is point pe vichar kijie.

  • @kunalkumar9399
    @kunalkumar9399 Před 3 lety +1

    💞💞💞

    • @Pepcoding
      @Pepcoding  Před 3 lety

      keep motivating, keep learning and keep loving Pepcoding😊

  • @rishabgangwar950
    @rishabgangwar950 Před 2 lety

    I am able to understand the problem but I am not able to solve them on my own before seeing the explanation. Is this a problem? How should I overcome it(I have solved 100+ problems from pepcoding)

  • @amandixit3555
    @amandixit3555 Před 3 lety

    sir ismei 3 ka pair allowed hai , like if we have 4 friends then 134, 123, 124, jaise case allowed honge ?

    • @Pepcoding
      @Pepcoding  Před 3 lety +4

      3 ka triplet hoga na, pair to 2 ka he hota hai.

  • @abhishekhorton79
    @abhishekhorton79 Před 3 lety +1

    Excellent explanation sir just a small doubt that when we are calling recursion on f(n-1) means when we are not including 1 as a pair
    Why don't we add 1 + f(n-1)? Because we should count 1 naa even if we are not including it.

  • @satya1067
    @satya1067 Před 3 lety +1

    ❤️❤️❤️❤️

    • @Pepcoding
      @Pepcoding  Před 3 lety +1

      keep loving Pepcoding😊

    • @satya1067
      @satya1067 Před 3 lety

      @@Pepcoding always 💻❤️

  • @TheShantanu1395
    @TheShantanu1395 Před 2 lety

    Python code for above problem
    def compute(n):
    dp = [0] * (n+1)
    for i in range(n+1):
    if i

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

    sir 3-4 hardest problems daal do please please like google interview very new type of hard problems

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

      Bhot jaldi aa rhe hain. Levelup ka backtracking bhot alag hoga, leetcode se geeksforgeeks se. Sabse alag.

    • @amritgupta5703
      @amritgupta5703 Před 4 lety

      ​@@Pepcoding thank u so much , faad faad que daal do interviews are going on ,that will be helpful

  • @shreyanshkasera8292
    @shreyanshkasera8292 Před 3 lety

    why cannot 1,2,3 be together?

  • @amitranjan6998
    @amitranjan6998 Před 2 lety

    This code will fail if n=1,coz dp=new int [n+1],it will create a size of 2 , and dp[2] will not exist . so make dp[0]=1 and dp[1]=1 and start for loop with i=2

  • @puspenduroy8458
    @puspenduroy8458 Před 2 lety

    bhaiye N=6569 kay liye galat aa rha hai 0 aa rha hai

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

    8 disliker are other youtube coder😂😂😂😜just Kidding

  • @AmanYadav-tq1po
    @AmanYadav-tq1po Před 3 lety +1

    And I'm like that bchha😂,
    But on getting error i turn to chellam sir of dp😁😂

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Thankyou beta!
      I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem.
      If you like our efforts, will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

  • @KrishnaGupta-xd6xu
    @KrishnaGupta-xd6xu Před 3 lety

    Sir is ques m tabulation ni use kra h .
    I am confused ki recursive approach use kru ya tabulation anyone pllz help🙏

    • @raghurajpratap5015
      @raghurajpratap5015 Před 3 lety

      koi bhi use krr le bhai..same hi hain dono.

    • @KrishnaGupta-xd6xu
      @KrishnaGupta-xd6xu Před 3 lety +1

      @@raghurajpratap5015 bhai tabulation s itna clear ni ho para
      So what i am asking hume phle konsi approach try krni h recursive ya tabulation

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Hmesha apko phle brute force approach se start krna chaheye.

    • @KrishnaGupta-xd6xu
      @KrishnaGupta-xd6xu Před 3 lety

      @@Pepcoding ok that's mean we have to start with recursion then go to dp
      Tq so much sir ☺ 🙏

  • @manavmalhotra8513
    @manavmalhotra8513 Před 3 lety

    dp[3] = 4
    ye rkh kr bhi pass ho rha hai
    !!!!!!!

  • @hritikagarwal7676
    @hritikagarwal7676 Před 3 lety

    The crux of the video 7:00

  • @kaushikrishi01
    @kaushikrishi01 Před 4 lety +1

    Sumeet Bhaiyya foundation khatam ?

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

      DP - 5 videos more (or 25 based on mood, if they don't come in foundation they will in levelup)
      Graph - 20 videos
      OOPs - 15 videos
      Time and Space - 10 videos
      Strings, SB and ArrayList - 10 videos

    • @dakshiaggarwal9627
      @dakshiaggarwal9627 Před 4 lety

      @@Pepcoding sir i request you..plss post 25 videos of dp..first in foundation only..plss sir ...placement tym is going on..i really need your videos.u r a life saviour..

  • @hritikchaudhary5470
    @hritikchaudhary5470 Před 3 lety

    please sir videos thodi choti banayo

    • @Pepcoding
      @Pepcoding  Před 3 lety +1

      Badi videos me hum aapko indepth knowledge de paate jo product based companies me important hoti hai

  • @suhailabbasi789
    @suhailabbasi789 Před 3 lety +1

    in "12" there is 2 pair (1) -> 1-2 (2) -> 12.
    in "123" we count (1) 1-2-3 (2) 1-23 (3) 12-3 (4) 13-2
    why 123 is not a pair there should be 5 ways to pair up (5) 123

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Beta, I regret to inform you that, I won't be able to answer/solve the personal doubts of each and every student over here. For clearing your doubts, you can join our community on telegram - t.me/pepcoding.

    • @shlokkumar1008
      @shlokkumar1008 Před 3 lety +3

      Because a pair has just 2 elements. 123 has three elements.

  • @luckymishra7399
    @luckymishra7399 Před 3 lety

    Just watched this video, is it not nc1 + nc2 ?
    for 4, 4c1 + 4c2 = 10

  • @ShivamKumar-cv7jv
    @ShivamKumar-cv7jv Před 3 lety

    haha i made the mistake of making permutation.......

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Koi nh beta. Glad you got your mistake, try to improve and remember it for the future.

    • @ShivamKumar-cv7jv
      @ShivamKumar-cv7jv Před 3 lety

      @@Pepcoding thnx sir and plz make more video regarding trees and graph also.

  • @shreeyagupta8472
    @shreeyagupta8472 Před 3 lety

    In this question, the equation is f(n)=f(n-1) + f(n-2)*(n-1) and not f(n)=f(n-1) +(n-1)* f(n-2). There is a difference between the two. In the former , recursion will take place first .