Coin Change Problems Analysis | Leetcode 322 v/s 518 Explained | Dynamic Programming In-Depth
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
I am an interviewer myself and never found such a great explanation of these problems before
We are glad to hear this. For much better experience please visit on nados.pepcoding.com
Also stay tuned on our Instagram account.
For all the curious minds: Pep means Energy and liveliness, Enthusiasm, Interestingness
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.
i wish you get enough success far better explainations than cn and cb.
:-)
Should never compare with cb they wasted my money. I just took because I was vmc student in school cb is worst
@@anjneykumarsingh4461 you went to vmc and cb now don't go for nagarro
better than ua
@@utkarshsharma6650 LOL
Thank you pepcoding for this detail analysis of the hardest topic, nothing better then this channel for the coders.
Glad you like them! I request you to post about us on linkedin.
This is gold! Other youtubers just post solutions to leetcode problems but no one talks about similarities like this. Thank you Sir!
I can't imagine anyone can explain better than our Sumeet Malik Sir 🙂 he is outstanding teacher in India for dsa
We can't Imagine a teacher better than you , You are the best .
Just started watching, sir you are amazing.
Loving your work ❤️❤️
Huge Respect sir. no one can beat your teaching style.
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...
All the best. Better late than never. Is it possible to write a post for our channel on linkedin?
I already have sir...
One of the best DP summary video
No one other than Sumit sir can teach these concept. Thank you sir
just amazing best teacher ever
Sir i didn't seen this much clarification in a you tube video for students. You are just Amazing Sir ❤❤
This is a great video. An awesome comparison of different problems and the approaches.
Glad it helped!
Thank you, sir, for this video. Great insight!
Glad it was helpful!
Itna sahi se koi kese explain kar sakta he😍🤟
Arey sir kya hi content h sahi me...paid me bhi aisa content ni h....aur fir aapki comedy..matlab ayhay...thank you sir
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.
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.
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😊
Thanks a lot Sir. this was amazing comparison. all 3 solutions are crystal clear now.
You are most welcome
So Good!
sir iss video ne questions ko dekhne ka nazariya he badal dia ! maza aa gya sir !
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 )
Sir, aaj to aaram krlie hote 🙏🙏
You are truly inspirational sumeet sir
mai chutti pe he hun aj. Video editting team se Moksh bhaiya is very hard working. He is just awesome.
thanks ..
outstanding explanation not even paid course explain such as deep
Awesome analysis Sir!!!!Thanku so much
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 )
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
Thankyou beta. I am glad that you liked my way of teaching🤩.
Keep learning and keep supporting Pepcoding😊
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
That cricket analogy is totally awesome
God level explanation
Thanks a lot Sir, all doubts got cleared
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 )
i solved the Target Sum Subsets question by creating dp[2][tar+1] for any numbers. saved space !!
Can you please share the code
@@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.
very very thank you sir for your hardwork to make us understand the concept it is really very helpful
It's my pleasure, for better experience and well organised content sign up on nados.io and start learning.
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
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?
bhai behtareen
Thank you so much.
Simply Great
Thankyou beta!
Keep watching and keep learning😊
couple goals
Thank you
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/
we Indians would not share your channel with others because this channel is literally the secret weapon for sharpening coding skills.
sir tss with 2d works for duplicates in array too right ?
when u use 100℅ of brain u get a flawless explanation like that
Thank You Sir for uploading these problems, they have really helped me understand and tackle DP problems confidently.
Thanks a lot. It would be great if you could share the channel on your FB and Linkedin.
hats off sir.. aaj ke rakhi ke din bhi aap videos bna rhe ho.. ❤️🔥
mai chutti pe he hun aj. Video editting team se Moksh bhaiya is very hard working. He is just awesome.
Great Explanation Sir
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 )
Great explanation sir😍
Thanks for liking
Sir can we make target sum problem in 1-d like coin Change problem ?
Thank you very much for providing such high quality content.
Neha ka interview clear hua kya ?
Sir in dp these three problems what and how was conveyed but the why part is missing.
this video is not available on website. please upload it there as well. i coincidentally got this video in my yt suggestions.
I am enjoying the learning process of DS Algo because of Sumeet Sir and Pepcoding. 👍🙏🙏
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 )
@@Pepcoding Done Sir 🙂
amazing
Thanks Man!
If you like our efforts, will you like to review us here - g.page/Pepcoding/review?rc
Mam ke saath aapne jo padhaya hai ye kaafi sahi hai ki kuvh doubt hote hai jo clear ho gaye
Kal se student firr sath bitha lenge.
@@Pepcoding Nooooooooooo sir plsss
CN CB CM aise dheero C leeao,pepcoding aakela hi kaafi hai inke liye 😂😂😂🔥🔥🔥
Happy Teachers Day sir
Thank you beta !!
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 .
Thank you so much beta.
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 )
baki ytbr bs code krte he apne guru ji feel dilate he 😃
very important : 27:20
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
sir mujhse recursion sochna chaiye iske liye??
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?
instead you can keep array of arraylist, both are fine
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
of course you can
Sir agar hamein permutations print karni jinmein duplicates nahi hon to ham permutations wale concept mein 2d array use karengey na ?
permutations ka defination check karo tumhara doubt khud hi clear ho jaiga.
2D use nhi hoga.
Great explanation sir. kya aur video aenge DP me ya ye playlist complete hai.
han beta. kal se levelup start ho rha hai. usme dp mei 70 questions hain. Foundation mei 30 the.
@@Pepcoding thank you very much sir
Sir aap target sum pair waale question Mai empty subset wala portion Ku leke chal the ho
kyunki empty subset sab subsets ka part hota hai aur 0 bna sakta hai
sir leetcode 322 alag question hai
or leetcode 518 coin combination h
Sir, is meaning assign anywhere in array?
Beta, hum khud assign kr rh h meaning.
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.
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.
@@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
@@vivekmit yeah, I think so …as long as being bounded means two choices for every element traversing in one direction of the list.
sir i'm back here after covid treatment . :)
Welcome back Beta and take care of your health keep motivating, keep learning and keep loving Pepcoding😊
Sir 518. Coin Change 2 on leetcode is different than both of these on the basis of what is asked in that question?
I will get it checked
@@Pepcoding Sir the concept is same as taught in the video
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
yes aur p n c ka difference kya hai?
@@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.
Sir itna jyada insight ajata apke analysis ko use se lgta h mai hi likh du aesa question
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
Done sir
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. ☺️☺️☺️
sir ye video aapne dp level1 ki playlist m nhi daal rakhi
site p
sir yeh video aapne website pe foundation ke andar dp section mai nahi daala i think
Dekhta hu beta
@@Pepcoding sir tss with 2d works for duplicates too right ?
@@Pepcoding duplicates in array
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.
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.
correct answer ashish
@@ashishgoswami6303 Thanks bro...
@@ashishgoswami6303 we can solve coin change combination using 2d and 1d both.
great video sir. But ek baat samaj ni aayi ki kb 2D dp bnani h or kb 1D
Beta, ye standalone videos main smjhana aur analyse krvana bhot mushkil h
@@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!!
Bhai 200 video kab honge
200 to kab ke ho chuke
if anyone still not able to understand it means he/she dont the difference between combination and permutation
coin change trilogy summarized
Keep learning and keep loving Pepcoding!😊
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.
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.
@@Pepcoding sir pehle hi aap saare possible doubts clear krte rehte ho aur flow toot jata hai aise thoda
vedio analysis like i enjoy avenger endgame fire