Coin Change Problems Analysis | Leetcode 322 v/s 518 Explained | Dynamic Programming In-Depth

Sdílet
Vložit
  • čas přidán 2. 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. With this video, we study the differences and similarities while solving the last three question, target sum subsets, coin change combinations and coin change permutations. We declare a group from these questions and how similar dynamic programming questions can be solved using the techniques of these questions.
    Leetcode 322 : • Coin Change Combinatio...
    Leetcode 518 : • Coin Change Permutatio...
    Target Sum Subset : • Target Sum Subsets Dyn...
    For a better experience and more exercises, VISIT: www.pepcoding.com/resources/o...
    #dp #coinchange #leetcode
    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 • 154

  • @shivangmittal9232
    @shivangmittal9232 Před 2 lety +25

    I am an interviewer myself and never found such a great explanation of these problems before

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

      We are glad to hear this. For much better experience please visit on nados.pepcoding.com
      Also stay tuned on our Instagram account.

  • @AbhishekSingh-fc6tb
    @AbhishekSingh-fc6tb Před 3 lety +26

    For all the curious minds: Pep means Energy and liveliness, Enthusiasm, Interestingness

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

      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.

  • @anuragpandey6760
    @anuragpandey6760 Před 4 lety +42

    i wish you get enough success far better explainations than cn and cb.

  • @ankurkumarraj
    @ankurkumarraj Před 4 lety +21

    Thank you pepcoding for this detail analysis of the hardest topic, nothing better then this channel for the coders.

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

      Glad you like them! I request you to post about us on linkedin.

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

    This is gold! Other youtubers just post solutions to leetcode problems but no one talks about similarities like this. Thank you Sir!

  • @techplacement3534
    @techplacement3534 Před rokem +3

    I can't imagine anyone can explain better than our Sumeet Malik Sir 🙂 he is outstanding teacher in India for dsa

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

    We can't Imagine a teacher better than you , You are the best .

  • @SiddharthSingh-ty3xz
    @SiddharthSingh-ty3xz Před 2 lety

    Just started watching, sir you are amazing.
    Loving your work ❤️❤️

  • @nitinmonga6975
    @nitinmonga6975 Před rokem

    Huge Respect sir. no one can beat your teaching style.

  • @pujasingh1413
    @pujasingh1413 Před 4 lety +14

    God bless you sir.. I have my interview in this month but I got to know about your channel recently n i am feeling so miserable that why I didn't know about you earlier... And thats why I suggested others... so that they dont regret like me...

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

      All the best. Better late than never. Is it possible to write a post for our channel on linkedin?

    • @pujasingh1413
      @pujasingh1413 Před 4 lety +4

      I already have sir...

  • @engulfing_marubozu
    @engulfing_marubozu Před rokem

    One of the best DP summary video

  • @AyushKumar-rh1vy
    @AyushKumar-rh1vy Před 2 lety

    No one other than Sumit sir can teach these concept. Thank you sir

  • @piyushkhandelwal1662
    @piyushkhandelwal1662 Před rokem

    just amazing best teacher ever

  • @B2T_SID
    @B2T_SID Před rokem +1

    Sir i didn't seen this much clarification in a you tube video for students. You are just Amazing Sir ❤❤

  • @bsethupathi1
    @bsethupathi1 Před 3 lety

    This is a great video. An awesome comparison of different problems and the approaches.

  • @mehakbhatia1314
    @mehakbhatia1314 Před 3 lety

    Thank you, sir, for this video. Great insight!

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

    Itna sahi se koi kese explain kar sakta he😍🤟

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

    Arey sir kya hi content h sahi me...paid me bhi aisa content ni h....aur fir aapki comedy..matlab ayhay...thank you sir

  • @krishnakeshri
    @krishnakeshri Před 3 lety

    Nice way of teaching , i wish ,i would have got this type of teacher in my college days, Any note on these topic would be beneficial.

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

    I think no one makes such sincere and dedicated efforts to make students understand such deep analysis of the question either free or by taking charge. I am saying this because I have explored many resources for ds and algo no one is BETTER THAN YOU. Thanks a ton for this AMAZING CONTENT.

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

  • @aashishgoyal1436
    @aashishgoyal1436 Před 3 lety

    Thanks a lot Sir. this was amazing comparison. all 3 solutions are crystal clear now.

  • @harshitbhatt6822
    @harshitbhatt6822 Před 2 lety

    So Good!

  • @SushantKumar-ev5uh
    @SushantKumar-ev5uh Před 3 lety

    sir iss video ne questions ko dekhne ka nazariya he badal dia ! maza aa gya sir !

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

      Shukriya ji..
      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 )

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

    Sir, aaj to aaram krlie hote 🙏🙏
    You are truly inspirational sumeet sir

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

      mai chutti pe he hun aj. Video editting team se Moksh bhaiya is very hard working. He is just awesome.

  • @AshishGusain17
    @AshishGusain17 Před 2 lety

    thanks ..

  • @GopalKumar-py2cf
    @GopalKumar-py2cf Před rokem

    outstanding explanation not even paid course explain such as deep

  • @rohanray8922
    @rohanray8922 Před 3 lety

    Awesome analysis Sir!!!!Thanku so much

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

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

    Sir, I think it is a better way to teach like this because this would keep us active throughout the video and absorbing more knowledge and for your efforts HUGE RESPECT... SIR

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Thankyou beta. I am glad that you liked my way of teaching🤩.
      Keep learning and keep supporting Pepcoding😊

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

    sir best explanation , mazza aagya ekdum
    sir ek req h isko foundation me website me dp me daldo coin change permutation ke bad..
    bcz website me sab organise hai to vahi se krte hai mostly sab..and vha yeah video nhi the....
    and sir aise or bi agar videos hai jo utube pr hai pr website pr nhi , plz upload taki hum koi bi video miss na krpaye...hope so or koi video mene miss na kre ho ... m foundation kr rha hu website se : )
    @pepcoding

  • @cooltomcatty
    @cooltomcatty Před rokem

    That cricket analogy is totally awesome

  • @harshvardhansingh780
    @harshvardhansingh780 Před 2 lety

    God level explanation

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

    Thanks a lot Sir, all doubts got cleared

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Always welcome.
      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 )

  • @Omprakash-wh4rb
    @Omprakash-wh4rb Před 2 lety +1

    i solved the Target Sum Subsets question by creating dp[2][tar+1] for any numbers. saved space !!

    • @sumitshokeen4065
      @sumitshokeen4065 Před 2 lety

      Can you please share the code

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

      @@sumitshokeen4065 you can see that for any dp[i][j], we need the result of dp[i-1][j] and dp[i-1][j-coins[i]], so that means when doing the problem using tabulation, we need only previous row and the current row.

  • @mdjawedalam722
    @mdjawedalam722 Před 2 lety

    very very thank you sir for your hardwork to make us understand the concept it is really very helpful

    • @Pepcoding
      @Pepcoding  Před 2 lety

      It's my pleasure, for better experience and well organised content sign up on nados.io and start learning.

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

    Sir Your teaching method is way beyond than awesome, but I noticed one mistake in this video, that in last when you explained combination again after TSS t=you wrote ".32" instead of ".23" , i think it is ".23" because, we have already done iteration for 2 1st so now 3 can only be concatenated in the end, just this else i try to do at least 5 questions per day, and you made DS so easy for me to understand. Thank you loads

  • @vankshubansal6495
    @vankshubansal6495 Před 3 lety

    Amazing video sir, thank-you so much. I just have one question, we can also solve target sum problem using 2 arrays right? After this, we can even use a single array. Am I right?

  • @shubhambravo
    @shubhambravo Před 3 lety

    bhai behtareen

  • @yashbansal1520
    @yashbansal1520 Před 3 lety

    Simply Great

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Thankyou beta!
      Keep watching and keep learning😊

  • @ShivamSharma-uw1uo
    @ShivamSharma-uw1uo Před 8 měsíci

    couple goals

  • @yadneshkhode3091
    @yadneshkhode3091 Před 2 lety

    Thank you

    • @Pepcoding
      @Pepcoding  Před 2 lety

      You're welcome
      For better experience and curated content sign up on nados.io
      And for being updated follow us on Instagram instagram.com/pepcoding/

  • @santoshreddy9963
    @santoshreddy9963 Před 2 lety

    we Indians would not share your channel with others because this channel is literally the secret weapon for sharpening coding skills.

  • @LegitGamer2345
    @LegitGamer2345 Před 3 lety

    sir tss with 2d works for duplicates in array too right ?

  • @adyakshsharma5057
    @adyakshsharma5057 Před 3 lety

    when u use 100℅ of brain u get a flawless explanation like that

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

    Thank You Sir for uploading these problems, they have really helped me understand and tackle DP problems confidently.

    • @Pepcoding
      @Pepcoding  Před 4 lety

      Thanks a lot. It would be great if you could share the channel on your FB and Linkedin.

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

    hats off sir.. aaj ke rakhi ke din bhi aap videos bna rhe ho.. ❤️🔥

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

      mai chutti pe he hun aj. Video editting team se Moksh bhaiya is very hard working. He is just awesome.

  • @aryangrover7216
    @aryangrover7216 Před 3 lety

    Great Explanation Sir

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Thankyou beta!
      I am glad you liked the videos.
      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 )

  • @aakashsharma5901
    @aakashsharma5901 Před 3 lety

    Great explanation sir😍

  • @152_ritikdiyundi9
    @152_ritikdiyundi9 Před 3 lety

    Sir can we make target sum problem in 1-d like coin Change problem ?

  • @444not
    @444not Před 3 lety +1

    Thank you very much for providing such high quality content.
    Neha ka interview clear hua kya ?

  • @KRISHNAK-bk1mh
    @KRISHNAK-bk1mh Před 2 lety

    Sir in dp these three problems what and how was conveyed but the why part is missing.

  • @tusharjha2150
    @tusharjha2150 Před 2 lety

    this video is not available on website. please upload it there as well. i coincidentally got this video in my yt suggestions.

  • @RishabhJain-hr6sz
    @RishabhJain-hr6sz Před 3 lety

    I am enjoying the learning process of DS Algo because of Sumeet Sir and Pepcoding. 👍🙏🙏

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

      Thank you so much 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 )

    • @RishabhJain-hr6sz
      @RishabhJain-hr6sz Před 3 lety

      @@Pepcoding Done Sir 🙂

  • @mahavirsingh5790
    @mahavirsingh5790 Před 3 lety

    amazing

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Thanks Man!
      If you like our efforts, will you like to review us here - g.page/Pepcoding/review?rc

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

    Mam ke saath aapne jo padhaya hai ye kaafi sahi hai ki kuvh doubt hote hai jo clear ho gaye

    • @Pepcoding
      @Pepcoding  Před 4 lety

      Kal se student firr sath bitha lenge.

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

      @@Pepcoding Nooooooooooo sir plsss

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

    CN CB CM aise dheero C leeao,pepcoding aakela hi kaafi hai inke liye 😂😂😂🔥🔥🔥

  • @financewithsom485
    @financewithsom485 Před 3 lety

    Happy Teachers Day sir

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

    I have only one word to say. DSA means PEPCODING. Before knowing your channel i think i am dumb as i am not able to solve any dp question , . but after knowing your channel i feel blessed .

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Thank you so much beta.

    • @Pepcoding
      @Pepcoding  Před 3 lety

      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 )

  • @AYJ959
    @AYJ959 Před rokem

    baki ytbr bs code krte he apne guru ji feel dilate he 😃

  • @Claire-uw1qv
    @Claire-uw1qv Před 5 měsíci +1

    very important : 27:20

  • @rajdeepghosh5556
    @rajdeepghosh5556 Před 2 lety

    Sir apka combination wala code leet code 322 wale problem pe nhi chal rha hai...1,2,5 coins se 11 pay nhi ho rha hai

  • @prakharagarwal4933
    @prakharagarwal4933 Před 3 lety

    sir mujhse recursion sochna chaiye iske liye??

  • @PradeepKumarIIITD
    @PradeepKumarIIITD Před 3 lety

    sir, to print the permutation, we have to keep an arraylist of string for each dp entry and then print the arraylist for the dp[amount ]? is that correct?

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

    Sir ,can it be done using 2-D matrix if we check in same row for remaining coin change when the coin(for which we are finding) is not included

  • @anjalirana7129
    @anjalirana7129 Před 2 lety

    Sir agar hamein permutations print karni jinmein duplicates nahi hon to ham permutations wale concept mein 2d array use karengey na ?

    • @chandan-ew4rp
      @chandan-ew4rp Před 2 lety

      permutations ka defination check karo tumhara doubt khud hi clear ho jaiga.
      2D use nhi hoga.

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

    Great explanation sir. kya aur video aenge DP me ya ye playlist complete hai.

    • @Pepcoding
      @Pepcoding  Před 4 lety

      han beta. kal se levelup start ho rha hai. usme dp mei 70 questions hain. Foundation mei 30 the.

    • @Jvdboss7
      @Jvdboss7 Před 4 lety

      @@Pepcoding thank you very much sir

  • @PankajDas-mw4uq
    @PankajDas-mw4uq Před 4 lety +1

    Sir aap target sum pair waale question Mai empty subset wala portion Ku leke chal the ho

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

      kyunki empty subset sab subsets ka part hota hai aur 0 bna sakta hai

  • @atulsharma3443
    @atulsharma3443 Před 2 lety

    sir leetcode 322 alag question hai
    or leetcode 518 coin combination h

  • @aniruddhrajput9239
    @aniruddhrajput9239 Před 3 lety

    Sir, is meaning assign anywhere in array?

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

      Beta, hum khud assign kr rh h meaning.

  • @vivekmit
    @vivekmit Před rokem

    I went through with Coin chain(Combi & Permu.) and Target Sum Subsets and did some analysis of why the coin chain was implemented using 1-D and TSS with 2-D but still have confusion why TSS problem can't be implemented with 1-D as I can see if any column in 2-D gets True then its successor row's same column has by default "True" so can't be achieve this TSS problem with 1-D as any index stored with "True", we will skip further iteration for this index. I am confused so I may not be in a position to try TSS with 1-D..please let me know, if you have any suggestion on this.

    • @anurocksification
      @anurocksification Před rokem

      I could be wrong but the intuition that I have so far is that if you have two choices for an element i.e you can either take an element or ignore you go with a 2D DP array because you have 2 subproblems to look at.This happens in 0/1 knapsack & target sum subset.On the other hand,if you have an unlimited supply of elements,you go for 1d array,because then you only solve the smaller subproblem without the current element.This happens in unbounded knapsack & coin-change.

    • @vivekmit
      @vivekmit Před rokem

      ​@@anurocksification thanks for your valuable response and time. I will dip dive more on your response and will develop my understanding. Do you mean for unbounded problem we can use 1-D and for bounded problem good to have 2-D

    • @anurocksification
      @anurocksification Před rokem

      @@vivekmit yeah, I think so …as long as being bounded means two choices for every element traversing in one direction of the list.

  • @jigarlove2113
    @jigarlove2113 Před 3 lety

    sir i'm back here after covid treatment . :)

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Welcome back Beta and take care of your health keep motivating, keep learning and keep loving Pepcoding😊

  • @KB-zg8ho
    @KB-zg8ho Před 3 lety

    Sir 518. Coin Change 2 on leetcode is different than both of these on the basis of what is asked in that question?

    • @Pepcoding
      @Pepcoding  Před 3 lety

      I will get it checked

    • @KB-zg8ho
      @KB-zg8ho Před 3 lety

      @@Pepcoding Sir the concept is same as taught in the video

  • @amandixit3555
    @amandixit3555 Před 3 lety

    sir coin change p and c aur tss mei yahi difference samajh aya hai ki tss aur coin change combination same hain bas in tss we dont have infinite supply of coins, aisa kahne se repetetion prevent ho jayega

    • @Pepcoding
      @Pepcoding  Před 3 lety

      yes aur p n c ka difference kya hai?

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

      @@Pepcoding c mei hum ek ek kar ke option bhar rahe the so that jo previous use hogaya hai voh dobara use na ho aur p mei humne for any number humne usse Sare option available ( coins ) de diye hain less then Or equal to that number.

  • @anjneykumarsingh4461
    @anjneykumarsingh4461 Před 3 lety

    Sir itna jyada insight ajata apke analysis ko use se lgta h mai hi likh du aesa question

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Glad it was helpful!! share as much as you can and it will be nice if you can write a post about us on LinkedIn

    • @anjneykumarsingh4461
      @anjneykumarsingh4461 Před 3 lety

      Done sir

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

    It took me a day to completely understand permutation. And the funny part is, to get answer for permutation by myself, i accidentally discovered combination ans with the table format. ☺️☺️☺️

  • @atulsharma3443
    @atulsharma3443 Před 3 lety

    sir ye video aapne dp level1 ki playlist m nhi daal rakhi

  • @LegitGamer2345
    @LegitGamer2345 Před 3 lety

    sir yeh video aapne website pe foundation ke andar dp section mai nahi daala i think

  • @AshokKumar-ot3dz
    @AshokKumar-ot3dz Před 3 lety

    Sir, Target subset sum mein to hum 2d array use kar rahein hain aur coin change mein 1d array. Aisa kyun yeh clearly clear nahi hua? Btw Great teaching sir. Thankyou so much for such a great content.

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

      Because we do not want to use a number again in Target sum subset.
      Hence we use 2d array to reuse the last value which cannot be duplicate.
      But in coin problems we are given that we have infinite coins of each type so we are using duplicates as we need.
      So a 1d array will work for us .
      If the case was to not allow duplicates in coin change as well we would have used 2d.

    • @Pepcoding
      @Pepcoding  Před 3 lety

      correct answer ashish

    • @AshokKumar-ot3dz
      @AshokKumar-ot3dz Před 3 lety

      @@ashishgoswami6303 Thanks bro...

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

      @@ashishgoswami6303 we can solve coin change combination using 2d and 1d both.

  • @janvisingla3746
    @janvisingla3746 Před 3 lety

    great video sir. But ek baat samaj ni aayi ki kb 2D dp bnani h or kb 1D

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Beta, ye standalone videos main smjhana aur analyse krvana bhot mushkil h

    • @janvisingla3746
      @janvisingla3746 Před 3 lety

      @@Pepcoding sir please ek video is pr bhi bnado ki kaisa pta chle ki kb konsi dimension ka array bnana chahiye baaki storage + assign meaning vo bahut ache se samaj aagya. Please sir ispe ek video bnadoo. Thank you!!

  • @sharathkumar8338
    @sharathkumar8338 Před 3 lety

    Bhai 200 video kab honge

  • @fashionvella730
    @fashionvella730 Před 3 lety

    if anyone still not able to understand it means he/she dont the difference between combination and permutation

  • @rohandas3687
    @rohandas3687 Před 3 lety

    coin change trilogy summarized

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Keep learning and keep loving Pepcoding!😊

  • @user-ji8lh6bw2v
    @user-ji8lh6bw2v Před 4 lety +9

    Sir please kissi aur ko include mat kijiye video mai, jab aap side mai ma'am ki trf dekhte hai ya unko explain krte ho toh kaffi distracting sa feel hota hai+ bakki videos mai aissa feel hota tha ki aap jaise hamme hi pdha rhe hai toh sahi sa connection bnn jata tha
    Btw thank you very much sir i really appreciate your hard work.

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

      beta, different styles try kar rhe hain. With a student with me, I am able to express better and she keeps me disciplined. I produce more output. I will try to focus on camera equally. And, I am certainly open to suggestions.

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

      @@Pepcoding sir pehle hi aap saare possible doubts clear krte rehte ho aur flow toot jata hai aise thoda

  • @AnkitSingh-tm5dp
    @AnkitSingh-tm5dp Před rokem

    vedio analysis like i enjoy avenger endgame fire