Top 5 Dynamic Programming Patterns for Coding Interviews - For Beginners
Vložit
- čas přidán 3. 06. 2024
- 🚀 neetcode.io/ - A better way to prepare for Coding Interviews
🐦 Twitter: / neetcode1
🥷 Discord: / discord
🐮 Support the channel: / neetcode
Top 5 DP Patterns Spreadsheet - docs.google.com/spreadsheets/...
Twitter: / neetcode1
Discord: / discord
⭐ BLIND-75 PLAYLIST: • Two Sum - Leetcode 1 -...
💡 CODING SOLUTIONS: • Coding Interview Solut...
💡 DYNAMIC PROGRAMMING PLAYLIST: • House Robber - Leetco...
🌲 TREE PLAYLIST: • Invert Binary Tree - D...
💡 GRAPH PLAYLIST: • Course Schedule - Grap...
💡 BACKTRACKING PLAYLIST: • Word Search - Backtrac...
💡 LINKED LIST PLAYLIST: • Reverse Linked List - ...
💡 BINARY SEARCH PLAYLIST: • Binary Search
0:00 - Intro
1:11 - 1. Fibonacci Numbers
6:45 - 2. Zero One Knapsack
13:07 - 3. Unbounded Knapsack
16:51 - 4. Longest Common Subsequence
23:30 - 5. Palindromes
#dynamic #programming #python
Disclosure: Some of the links above may be affiliate links, from which I may earn a small commission. - Věda a technologie
🚀 neetcode.io/ - A better way to prepare for Coding Interviews
These are good and makes me realize what a great CS curriculum I had that covered all 5 of these lol. I would also study
6. DFS + memoization (Longest Increasing Path in a Matrix, Path Sum III)
7. Backtracking + memoization (Regex/Wildcard, Partition to K Equal Sum Subsets)
8. State Machine (Best Time to Buy & Sell Stock variations)
are dfs + memoization & backtracking + memoization the same? at least in neetcode's videos, he uses dfs algo for any backtracking problem
@@dj1984x DFS is not just backtracking, but backtracking is always DFS.
This channel is such a great find. I just wish there were more videos haha
DP = recursion + memoization. Then, if you want to memoize using an array instead of a hash map, you can optimize that after. So it's no harder than recursion. But DP often uses a variable number of subproblems, while more straightforward recursions use only one or two subproblems.
I want to thank Neetcode. The videos were great resource to learn coding and crack tech interviews. I'm very thankful to this channel. Hope your channel grows more and more. ❤️
This is truly life saving! Please make more of this type of videos for other topics.
Guy, you really helped me a lot! After watching Climbing Stairs video I did solve Maximum Alternating Subsequence Sum problem not only using DP but using bottom up approach!
Thank you! This is so helpful! I look forward to more of this type pf high level overview :)
This is perfect. Thank you.
Can you please make similar lists for other topics as well? That will be extremely helpful because while solving the problem it's good to have an idea about general approach you'll be following..
Brilliant explanation, your videos are extremely helpful, thank you for doing all the good work :)
some real quality content here.
interview material is usually bloated with edgy-cleverish stuff, not structured according to problem's domain of knowledge and not prioritized correctly.
you, sir, have managed to sort all that out.
thank 🤜🤛
This style of videos is very informative. It helps to structure and categorize the information related to DP problems and allows to come to the solution faster.
The way you explain CS is awesome, bro! Keep doing the good job!
this is so AWESOME!!! thanks for sharing your knowledge :)
Great stuff! I have learned a lot from your videos. Please do more of these!
very clear explanation. good job NeetCode. keep up to date your videos . thanks
Easily the best LC channel, thank you :)
The best Python Leetcode problem solver. Love u brother ❤️
Your videos are really helpful. Just a suggestion, it would be really nice if you could create a video on when we should do backtracking vs dynamic programming. As some seems to fall on both with different runtime and people use different solutions
actually, i think both backtracking and dp is bruteforce which try all combination, but if one can build an optimal structure and a DAG , then definitely we should use dp to reduce from exponential time (backtracking/dfs)
We use dp when their are overlapping sub-problems, here in this problem their is not any sub-problem(part of problem we have already solved)
I'm not confident with dp problems. But this spreadsheet is awesome!! Thank you as always. And congrats you've gained 10k subscribers so far :) You deserve more.
damn so he got 200k within year
damnnn 250k now
516k now
another 30k in a month dayum@@liz.1328
@@liz.1328 700k+ now
Please make and share more videos / spreadsheets like this
They are really helpful for practice 🙏
Love the videos. SMALL EDIT: For the “Unbounded Knapsack”, we do not need 2D array. We only need to know MIN(coinsUsed) at each position. Since we can use any coin at each position, we do not need to track type of coins used.
The feeling that the athor somehow bullshittin us huh ? 😀
Thanks for sharing this approach.
amazing, please keep doing this wonderful work.
Thanks for this spreadsheet.
Very Important for understanding core concepts of dynamic programming.
Awesome video! thank you so much
Thanks a lot! You're the best
Really helpful, thank you very much
Can you please make videos on fundamental DP questions (such as the ones you listed in this video) and solve them with multiple solutions describing how you build intuition to build the Brute Force way and optimized it in Top-Bottom/Bottom-Up fashion and finally optimized it with constant space.
I understand you have explained the approaches in a your videos but can you go in a bit more depth as to how you came up with the Brute Force approach and how you thought that I can optimize it in this way.
Your videos have been of great help, Thank you.
I've been doing DP for a while so not exactly a beginner, but this is still helpful way to see things
very good video! thanks so much.
Looking forward for this
U are just awesome. thanks a lot
You are just saviour in my battle-hour!
The best Leetcode channel ever
Finally I finish all the exercises listed in the dp spreadsheet. It has been a lot of help, thank u. wish there are more summary videos like this.
Are you spying on me? This is literally what I was searching for! xD
not he, it is goo...
thx for your work!
man i just so love you!!
Could you please add the 'Matrix Chain Multiplication' category to this sheet?
Great Video!!!!, are you a faang employee??
I think this is really good, though I think we should motivate recursion way more. The grid is fine, but it makes more sense doing that
Thanks alot . Too good....!!!
You got the subscriber💕💕
Ace video, mate.
I don't think 0/1 in 0/1 Knapsack refer to finite/infinite number of the item - its more about if the item put in the knapsack can be fractional or not. 0/1 means either it exists in the knapsack or it does not - in fractional knapsack, you can pick fraction of some item as well -- which would be represented as .someDecimalValue, not 0/1.
Yes correct, this falls in the category of unbounded knapsack where you are not confined to use the element only once.
you are the best teacher
you are the god !! thank you
Fantastic video
You're my hero.
Thanks a lot ! But after seeing this video i was trying to solve the 1/0 knapsack problem type - equal partition based on tabular method rather than your solution video of the same. Unfortunately I am not able to solve the same can you please create video how tabular method works for the same question ?
Can you make a video on Critical connections?
Thank you neetcode
Could you please do a video on "Longest Palindromic Subsequence"?
very clear
I think Longest Increasing Subsequences (LIS) type problems deserve its own category ... Also Maximum Sum Subarray (Kadanes Algo)
Yeah LIS is pretty big, you have problems like Russian Doll Envelopes & Box Stacking.
From your Dynamic Programming Patterns sheet, I think Fibonacci Number is kind of Linear DP problem whereas House Robber is more of a Decision Making kind of problem so they should not be falling in the same bucket in case you are categorizing them. Any thoughts?
Omg ily so much. I think you are missing Matrix Chain Multiplication pattern and DP on trees. But still ILY!!
Just what I was looking for, ty! Just a thought maybe you could extend this to other types of leetcode problems?
Good idea, I definitely will try to work on that!
Thanks!
Thank you so much Alex!!!
I'm just wondering what your adivce would be on how much and what algorithms in terms of coding I should know if I wanna apply for Amazon data scientist role? Thank you!
what is the device / software thatdraws on the screen? very interesting
Thanks. You just made it clear. fear---;
Curious what device and software you use to present like this.
KING
Love it~
Another category that might be helpful here is probably matrix/maze problems
What does for beginners mean? Are there more patterns?
Amazing
After i suggested neetcode to my friend’s
My friends: should we bow ?
Me: Yeah, he’s a king.
Really love the content, keep going 🔥
Do you think it okay to solve DP problems with recursion with memoization? It's often much easier for me to conceptualize the recursive implementation than the iterative one.
Theoretically it should be the same, but with the use of the call stack.
It's slower but it's ok.
This is probably a long shot but can someone explain how the palindrome solutions are DP? Ive seen the individual problem solutions and they all use the expand from center trick which isn't really memoization thus not really DP(at least how I understand it). On LC, I see solutions of more standard DP approaches that use a 2d array to memoize a string from any 2 start&end points.
Low-key thanks.
why you don't use Binet equation for fibonacci ?
Mr. Neet Code. I wanna make a request for 935. Knight Dialer if you struggle to choose a question. it is asked by Facebook and there is no explanation on youtube.
right
Is this the same guy who posts daily dose of internet?
how to get the spreedsheet
You're one the rare examples of someone with an American accent who pronounces "new" like "nyoo" instead of "noo"
why you don't put this video a the first place in this dp series
can i get the spreedsheet?
Link should be in the description (let me know if its not working)
Where is the speadsheet?
Did you check the description?
@@NeetCode oops thanks
Binary tree cameras leetcode
Can u please reduce the number of adds it's too much irritating
5:25
the "right?" is pretty distracting
I feel so stupid watching these videos.
You seem to make things harder with explanation and graphs. You should explain with a datastructure, like in an array or hashmap, etc or say a for-loop etc for context to make it easier to understand.
n33tc0de, I love u bruh
Thanks!
Thanks!
Thanks!
Thanks!
Thanks!
Thank you so much, I really appreciate it! 😊