4th step sometimes not possible, but yeah up to 3 definitely.
luisquesada5241 year, 1 month ago
Currently a senior software engineer, coding for 6 years and never had to do this once
T
tristan.miller1 year, 10 months ago
I'm just a tradesman and stumbled upon this vid. I have NO idea what's going on but it looks cool
R
ross.woodward2 years, 6 months ago
Master Data Structures & Algorithms For FREE at AlgoMap.io!
S
shawnbird2422 years, 2 months ago
very good summary of the step by step optimisation of DP problems, but it is hard for new learner to understand these 4 steps without a full blown explanation.
B
bradley.page1 year, 7 months ago
I have been doing this with success 1. Identify states & understand state changes 2. Identify base case(s) 3. Identify recurrence relation 4. Top-down recursion + memoization 5. Bottom-up Tabulation 6. If possible, optimize space by removing a dimension in state
micheal_santiago2 years, 6 months ago
Just throw a HashMap on it
Z
zoé_rousset2 years, 6 months ago
I thought I was good with Python until I saw this video
J
john.jensen1 year, 10 months ago
With these shorts, i should be able to become a code guru in one hour.
sarah_wallace2 years, 3 months ago
I find that top-down solutions are easier to understand due to the decision tree nature of the solution as opposed to the bottom-up with dp that is sometimes harder to find the transition step.
K
kimberlyechoing261 year ago
When at an interview, present four solutions to every problem. Got it.
advika_tara2 years, 6 months ago
Great video demonstrating progressive code refinement. Still not sure if the first step should be called "recursive backtracking". As discussed in previous video, think this is just "naïve recursion".
A
ayushman.chaudry2 years, 3 months ago
What's complicated about DP IMO is figuring out what do the output depend on in such a way that it's memoizable, when facing new and complicated problems, It's not obvious at all
R
rodneyserene41 year, 3 months ago
In simple terms: 1) Recursive code (brute force) 2) Top-Down (Recursive + memoization) 3) Bottom Up / Tabulation (using looping) 4) Optimisation of space from previous solutions (use variables instead of extra dp array)
C
christopher_moon2 years, 6 months ago
I think the memo dict would be a new one for each stack frame. I might be wrong. You are better off using lru_cache from functools or make the dict global
B
brianmartin4401 year, 8 months ago
You could solve it in O(log(n)). Some say this problem could be solved in O(1), but they need to calculate the square root, and this costs O(log(n)).
V
victoria_elliott1 year, 3 months ago
I'm a software engineer and understood some of these words. I'm not good at my job if you can tell.
T
thomastempest621 year, 1 month ago
Programmer of 10 years over here. I am so glad I don’t have to jump through hoops with this shit where I live and be trusted to Google shit I need, altough if someone asked me to write a fib and said I can’t use a standard library I would go work elsewhere 😅
C
christopher_thompson2 years, 1 month ago
What do DP do?: It actually selects one best solution from all the possibilities And the possibilities are reduced by reusing/Memorization/Tabulation,(when there are 2 or more subproblems overlapping then we can avoid those subproblems and substitute from the memorization 😎)
M
maríacristina_deanda2 years, 6 months ago
I feel like you just summed up one the first lecture on dynamic programming from an old mitocw series
4th step sometimes not possible, but yeah up to 3 definitely.
Currently a senior software engineer, coding for 6 years and never had to do this once
I'm just a tradesman and stumbled upon this vid. I have NO idea what's going on but it looks cool
Master Data Structures & Algorithms For FREE at AlgoMap.io!
very good summary of the step by step optimisation of DP problems, but it is hard for new learner to understand these 4 steps without a full blown explanation.
I have been doing this with success 1. Identify states & understand state changes 2. Identify base case(s) 3. Identify recurrence relation 4. Top-down recursion + memoization 5. Bottom-up Tabulation 6. If possible, optimize space by removing a dimension in state
Just throw a HashMap on it
I thought I was good with Python until I saw this video
With these shorts, i should be able to become a code guru in one hour.
I find that top-down solutions are easier to understand due to the decision tree nature of the solution as opposed to the bottom-up with dp that is sometimes harder to find the transition step.
When at an interview, present four solutions to every problem. Got it.
Great video demonstrating progressive code refinement. Still not sure if the first step should be called "recursive backtracking". As discussed in previous video, think this is just "naïve recursion".
What's complicated about DP IMO is figuring out what do the output depend on in such a way that it's memoizable, when facing new and complicated problems, It's not obvious at all
In simple terms: 1) Recursive code (brute force) 2) Top-Down (Recursive + memoization) 3) Bottom Up / Tabulation (using looping) 4) Optimisation of space from previous solutions (use variables instead of extra dp array)
I think the memo dict would be a new one for each stack frame. I might be wrong. You are better off using lru_cache from functools or make the dict global
You could solve it in O(log(n)). Some say this problem could be solved in O(1), but they need to calculate the square root, and this costs O(log(n)).
I'm a software engineer and understood some of these words. I'm not good at my job if you can tell.
Programmer of 10 years over here. I am so glad I don’t have to jump through hoops with this shit where I live and be trusted to Google shit I need, altough if someone asked me to write a fib and said I can’t use a standard library I would go work elsewhere 😅
What do DP do?: It actually selects one best solution from all the possibilities And the possibilities are reduced by reusing/Memorization/Tabulation,(when there are 2 or more subproblems overlapping then we can avoid those subproblems and substitute from the memorization 😎)
I feel like you just summed up one the first lecture on dynamic programming from an old mitocw series