Soultrob Soultrob
Home Videos Search Liked Videos Bookmarked Inbox Notifications Sign In
Get it on Google Play Log In
Soultrob
0:00
0:57
0:57

4 Steps to Solve Any Dynamic Programming (DP) Problem

Education

FAANG Coding Interviews / Data Structures and Algorithms / Leetcode

ADVERTISEMENT
Comments 100 elaine_fry: 4th step sometimes not possible, but yeah up to 3 definitel…
More Like This
What does Rocky eat in Project Hail Mary? #projecthailmary #rocky #ryangosling #movie 1:15
What does Rocky eat in Project Hail Mary? #projecthailmary #rocky #ryangosling #movie
Education 3.0k 64
HOW IRAN SHOT USA's F35 #viral #space #3danimation #explained #science #documentary 1:11
HOW IRAN SHOT USA's F35 #viral #space #3danimation #explained #science #documentary
Education 0 0
The Discovery That Broke Every Rule Of Science.#viral #documentary #trending #fyp #history#explained 0:48
The Discovery That Broke Every Rule Of Science.#viral #documentary #trending #fyp #history#explained
Education 5 0
#media 0:30
#media
Education 0 1
A Glacier Started Pouring Blood-Red Water...! 0:50
A Glacier Started Pouring Blood-Red Water...!
Education 42 0
Pagal Scientist ki Galti se Faila ZOMBIE VIRUS | COLONY Korean Movie Explained In Hindi 18:15
Pagal Scientist ki Galti se Faila ZOMBIE VIRUS | COLONY Korean Movie Explained In Hindi
Education 129 1
Storks’ Superpowers Explained: The Science You Never Knew!  (ANALYSIS.) documentary bio. 1:05
Storks’ Superpowers Explained: The Science You Never Knew! (ANALYSIS.) documentary bio.
Education 10 0
“Runny Nose Science Explained: 3D Inside Your Body Documentary”#shorts #viral 0:47
“Runny Nose Science Explained: 3D Inside Your Body Documentary”#shorts #viral
Education 41 0
You've reached the end

Comments 100

Sign in to join the conversation

Sign in
E
elaine_fry 2 years, 6 months ago

4th step sometimes not possible, but yeah up to 3 definitely.

luisquesada524
luisquesada524 1 year, 1 month ago

Currently a senior software engineer, coding for 6 years and never had to do this once

T
tristan.miller 1 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.woodward 2 years, 6 months ago

Master Data Structures & Algorithms For FREE at AlgoMap.io!

S
shawnbird242 2 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.page 1 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_santiago
micheal_santiago 2 years, 6 months ago

Just throw a HashMap on it

Z
zoé_rousset 2 years, 6 months ago

I thought I was good with Python until I saw this video

J
john.jensen 1 year, 10 months ago

With these shorts, i should be able to become a code guru in one hour.

sarah_wallace
sarah_wallace 2 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
kimberlyechoing26 1 year ago

When at an interview, present four solutions to every problem. Got it.

advika_tara
advika_tara 2 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.chaudry 2 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
rodneyserene4 1 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_moon 2 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
brianmartin440 1 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_elliott 1 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
thomastempest62 1 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_thompson 2 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_deanda 2 years, 6 months ago

I feel like you just summed up one the first lecture on dynamic programming from an old mitocw series

You've reached the end
  • Home
  • For You
  • Search
  • Sign In