5 Simple Steps for Solving Dynamic Programming Problems

preview_player
Показать описание
In this video, we go over five steps that you can use as a framework to solve dynamic programming problems. You will see how these steps are applied to two specific dynamic programming problems: the longest increasing subsequence problem and optimal box stacking. The five steps in order are as follows:

1. Visualize examples
2. Find an appropriate subproblem
3. Find relationships among subproblems
4. Generalize the relationship
5. Implement by solving subproblems in order

After taking an in depth look at these problems, at the end of the video we will also have a discussion about common subproblems that you may encounter while solving dynamic programming problems.

Error correction: for the box problem, using dictionary solutions only works if we are given unique boxes -- using a list of subproblems would be a better way to solve it if we wanted to handle duplicate boxes (similar to how we did the longest increasing subsequence).

Music:

All other music by Aakash Gandhi
Рекомендации по теме
Комментарии
Автор

Press F to pay respects to all the people out there that chose the wrong subproblem definition during an interview.

airmanfair
Автор

Thank you for teaching me in 20 minutes what my professor could not explain in 2 hours, please keep making content !

balkiskaroui
Автор

I can't thank you more for this video! Most videos out there put a lot of efforts explaining how to solve a dynamic problem with recursion, memoization, bottom-up yadayada... But for me, the most challenging part is figure out what on the earth the problem wants me to do! Your five steps really point out a promising pattern that I can build my own thinking process with. Thank you!

yangweiyili
Автор

I love this method to explain. Good job! You have mixed the math reasoning and the practical implementation in an ordered and logical way.

williambertolasi
Автор

Unlike most of the other DP videos out there, this one goes into both simple (yet non-trivial) and challenging examples, which are way more likely to be seen in an interview setting instead of problems like Fibonacci, which are beaten to death. The animation is great and the use of DAGs for visualization really helps things click. I'm genuinely surprised I haven't seen most other resources explicitly mention this DAG-based way of thinking about DP problems before, because it makes it infinitely easier to identify subproblems and their relationships (which was my main roadblock for getting to a DP solution, and likely is for others as well). Keep up the great work and I'll be sure to support you in the future!

koober_
Автор

I really like how your explain and visualize the problem for us. Really appreciate your work. Looking forward to learning more concepts from your video

linchen
Автор

Wow, you’re gonna blow up dude. These animations are insanely good for learning. Amazing work

tristandam
Автор

Love this video! Really easy to understand and content is professional. Looking forward to more videos from you.

dnagal
Автор

This is probably the best video about Dynamic Programming I've seen on YouTube, it covers everything from idea to code and I usually have struggles reading the math but the animation really helped break down what's going on. Keep it up, would love to see more examples! Would you ever plan to make object oriented programming videos in the future?

tiffanyk
Автор

This is such a great channel, but man, you need to invest in a better microphone...

FoxInFlame
Автор

Thank you so much for generalizing such a complex problem in such an way that is so easy to understand. Keep up the great work!

jduckkk_
Автор

The Best part is you made us think through the process and how to break down a problem. Amazing work.

poshakj
Автор

Thank you for all your videos! I particularly struggle with dynamic programming, and a few months ago I started solving a lot more questions, but eventually took a break when I felt I wasn’t really understanding why some of my solutions worked.. Anyway, the DAG representation is new to me, and I’m going to try out some more problems again! Always nice to get a new perspective on things

rampagex
Автор

Thanks so much! I like how you 11:13 provide a visualization of the approach and 16:42 go through the implementation. I haven't seen any video describing DP like this!

TheTessatje
Автор

I am definitely sharing this video with my friends and so should everyone else!! Thanks for the amazing tutorial.

anmolabhayjain
Автор

Let's give this guy a real appreciation for visualisation, animation and clear cut explanation. Probably the best on this topic on YouTube ❤️

travelspurs
Автор

I was looking for something like this which explains how to solve dynamic programming step by step rather than just solving questions. This video helped me in a better understanding of dynamic programming than ever before.

chaitanyalal
Автор

This is pure gold, someone please give this guy a medal !

vlinkin
Автор

I really like the way you explained, it's clean and clear, it's much better than any course about DP in computer science class I took. Visualization DP problem as graph and finding sub-problem are great points, I just love it.

haitu
Автор

This is finally making me understand DP and how to solve those problems without overcomplicating them

i love how you go from explaining the idea to actually fully explaining some code and not just pseudo code

legenarian