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

Sign in to join the conversation

Sign in
B
bradley.page 1 week ago

Dude made a career out of Fibonacci series

sarah_wallace
sarah_wallace 2 months, 1 week ago

The last one is pretty sick to pull off.

D
damien_davies 2 months, 4 weeks ago

How to draw a masterpiece: 1. Prepare paper. 2. Prepare pencils and an eraser. 3. Draw.

H
hakanhenk747 3 months, 4 weeks ago

Naive recursion approach is also called backtracking? It's slightly different from what I learned when I was a sophomore

pedrolucas.abreu
pedrolucas.abreu 4 months, 2 weeks ago

Why in the 2° code there is an def inside an def?

D
dimitrios_bonbach 5 months ago

I am able to solve for top down approach pretty consistently, the intuition for bottom up doesn’t come to me naturally

paulvaleon6
paulvaleon6 5 months, 4 weeks ago

Lmao "how to solve DP in 4 steps" is to solve it 4 ways without any explanation of how to do any single step. Great vid

N
nicholas_smith 7 months, 1 week ago

Good, now all i have to do is learn dynamic programming now

S
sherrybaker792 7 months, 3 weeks ago

Thanks for sharing!

N
normamcconnell229 8 months, 2 weeks ago

Wonderful ❤

M
michelle.ortega 8 months, 2 weeks ago

one liner: def fib(x): return int(round((((1 + 5**0.5) / 2)**n - ((1 - 5**0.5) / 2)**n) / 5**0.5, 1))

N
nermin.täsche 8 months, 3 weeks ago

When you get stuck on a problem throw a hash map at it 👍

C
cynthia.costa 8 months, 3 weeks ago

Fibonacci is a strange example, as there is a fixed formula to compute fib(n). No recursion or loops required. Ok there are roots and exponents to take care of, yet still a great way to calculate it.

G
gabriela.miranda 8 months, 3 weeks ago

Dead on summary. This is exactly what you'll notice if you get through Neetcode 250.

revadawn74
revadawn74 9 months, 1 week ago

The 4th solution is how old timers use their old calculators with registers, not lines of formula in moden day calculators.

S
stéphane.perrin 9 months, 2 weeks ago

I have no idea what you just said.... but now that I know something was said... it's time to chat google everything

K
kimberlyechoing26 9 months, 3 weeks ago

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

T
thomastempest62 10 months, 2 weeks 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 😅

luisquesada524
luisquesada524 11 months ago

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

joshuachen282
joshuachen282 11 months ago

Remember that tail recursion exists