Coin Change (LeetCode 322) | Full solution with beautiful diagrams and visuals | Simplified

preview_player
Показать описание

One cannot emphasize enough how important this problem is. Almost asked in every tech company at every level of interview as it tests your critical thinking ability and how well you understand dynamic programming. This video show a step by step approach, how you can attack and solve such problems with beautiful animations and diagrams. You will never remember the solution by heart and never forget it again.

Chapters:
00:00 - Intro
01:11 - Problem Statement and Description
03:35 - Brute Force Solution is not optimal
04:21 - A greedy approach does not work
07:15 - Building a dynamic programming solution
18:50 - Dry-run of Code
20:51 - Final Thoughts

📚 Links to topics I talk about in the video:

📖 Reference Books:

🎥 My Recording Gear:

💻 Get Social 💻

#leetcode #programming #interview
Рекомендации по теме
Комментарии
Автор

Looked at neetcode's solution 3 times and didn't undertand it. Here I understand it the first time. Thank you!

boisaulit
Автор

Nice explanation of the concept. Keep doing more such videos. ❤
However, just wanted to add a small detail here (in favour of others checking as well). It would be good if we could also initialise minCoinsDp[0] to 0 explicitly. As to reach amount 0, fewest number of coins is 0. Since its java code, I think it gets initialised automatically to 0, but for other primitive languages like c, c++ we need an initialiser and the loop in the example code is only running from i=1 (skipping 0).

vector<int> minCoinsDp(amount+1, INT_MAX); // default initialise all to INT_MAX
minCoinsDp[0]=0; // special case

If the code can be adjusted as above, all such ambiguity can be cleared.

krrishh
Автор

like everyone else, this was the first explanation of this problem (and dynamic programming in general) that made any sense to me. thank you!!

ellenstuder
Автор

Absolutely Amazing Explanation, one & only on Youtube, MARK MY WORDS!!

pulkitjain
Автор

The amount of clarity you had in your explanation is truly amazing!!

SumanthKumar-eiqp
Автор

Gotcha, you finally made me understand that. After looking 3 different other videos and still was completely lost, thank you.

codeforfreedom
Автор

Best explanation ever! I was really struggling with this one. Big thank-you to you sir!

huaqian
Автор

I was so happy whenever I search a problem on Leetcode and find your video !

duyviet
Автор

Amazing visualisation of the problem which helped me clearly understand the solution. Please continue doing your explanation with visualisations, they're extremely helpful

anirudhakrishna
Автор

after watching many vedios i found this, The best explanation ever.

SahanaNaik-mh
Автор

Dude you deserve more subscribers
Wonderful explanation

amansahil
Автор

Listen, your explanation for this f**king question is the best online!
Let's put aside the fact that you'll never need this in a real job, but for job interviews, this specific explanation is the best—much better than Neetcode

whiletrue-wbxf
Автор

Why are all of these comments saying "came from neetcode didn't understand" XD side note, you are doing a great job thoroughly explaining the leetcode problems. One problem I have with neetcode is his solutions are always in Python and I am obv a Java person. So ur videos help me a lot! Thanks and plz keep going!!

ruby
Автор

Cleanest solution I could find for this problem. Thank you !

parth
Автор

Great intention and good patience in explaining the approach. Kudos 🎉

nandhakumarkr
Автор

Gone through so many other video solutions but understood nothing. This is the best explanation ever for this question!!

maharshikongari
Автор

underated youtuber, u deserve views in millions brother

sathviku-sp
Автор

Your way of explaining is excellent sir..

mdshahidansari
Автор

Great explanation, thank you very much for making DP so easy.

_RohitKasture
Автор

Great explanation with amazing clear drawings. Thanks.

ashok