Dynamic Programming Fundamentals

You know recursion. Now see how memoization and tabulation turn exponential solutions into polynomial ones.

45 lessons
193 min
Codeforces: 1000-1700LeetCode: 1300-1700

Lessons

1. Intro

The power of optimization

4m

2. LeetCode 509 Fibonacci - Problem Statement

LC 509 classic

3m1 problems

3. LeetCode 509 Fibonacci - Base Cases

Two starting points

4m

4. LeetCode 509 Fibonacci - Recursive Formula

Two calls

3m

5. LeetCode 509 Fibonacci - Naive Implementation

Direct translation

3m1 problems

6. Visualization - Fibonacci Tree

Explosion of calls

4m

7. Vocabulary - Overlapping Subproblems

Same work repeated

3m

8. Time Complexity - Exponential Growth

O(2^n) disaster

4m

9. The Main Idea

Remember results

3m

10. Socratic Checkpoint

Test your understanding

3m

11. Recursion to DP

The bridge

4m

12. What Is Memoization?

Caching results

4m

13. Vocabulary - Top-Down DP

Starting from the top

3m

14. LeetCode 509 Fibonacci - Memoization Setup

Adding memory

5m

15. LeetCode 509 Fibonacci - Memoized Code

Three extra lines

6m

16. Memoization - Time Complexity

O(n) now!

5m

17. Memoization - Space Complexity

O(n) cost

4m

18. LeetCode 70 Climbing Stairs - Problem Statement

LC 70 Fibonacci disguise

5m1 problems

19. LeetCode 70 Climbing Stairs - Recursive Intuition

DP basics

4m

20. LeetCode 70 Climbing Stairs - Memoized Solution

Apply the pattern

6m

21. LeetCode 70 Climbing Stairs - Implementation

The code

5m1 problems

22. Quiz: Memoization Complexity

Knowledge check

5m1 problems

23. Lessons from Memoization

Pattern recap

3m

24. What Is Tabulation?

Building from ground up

5m

25. Vocabulary - Bottom-Up DP

Why called bottom-up

3m

26. LeetCode 509 Fibonacci - Tabulation Implementation

Iterative solution

6m1 problems

27. Space Optimization

Only keep what you need

5m

28. LeetCode 509 Fibonacci - O(1) Space

Most efficient

6m

29. Top-Down vs Bottom-Up

When to use each

5m

30. LeetCode 746 Min Cost Climbing Stairs - Problem Statement

Your first cost problem

3m1 problems

31. LeetCode 746 Min Cost Climbing Stairs - State Definition

What dp[i] means

4m

32. LeetCode 746 Min Cost Climbing Stairs - Transition

Choose cheaper path

4m

33. LeetCode 746 Min Cost Climbing Stairs - Implementation

Full solution

5m1 problems

34. LeetCode 152 Maximum Product Subarray - Problem Statement

Read the problem

3m1 problems

35. LeetCode 152 Maximum Product Subarray - Why It's Tricky

Negative numbers twist

5m

36. LeetCode 152 Maximum Product Subarray - Tracking Two States

Track min and max

5m

37. LeetCode 152 Maximum Product Subarray - Implementation

Full solution

7m1 problems

38. Quiz: Simple DP Patterns

Knowledge check

3m1 problems

39. LeetCode 91 Decode Ways - Problem Statement

LeetCode 91

3m1 problems

40. LeetCode 91 Decode Ways - The Choices

One or two digits

5m

41. LeetCode 91 Decode Ways - Edge Cases

Leading zeros

5m

42. LeetCode 91 Decode Ways - State Definition

Ways to decode

4m

43. LeetCode 91 Decode Ways - Transition

Two choices

4m

44. LeetCode 91 Decode Ways - Implementation

The code

5m1 problems

45. Section Recap

What we learned

5m

Practice Problems

1.
The sumCodeforceseasy

Show how memoization reduces execution time by preventing recalculation.

2.

Shows how Fibonacci patterns extend to any recurrence with more terms

3.

The perfect first DP problem - simple state, clear transitions, builds intuition for optimal substructure.

4.

Digit manipulation with greedy DP approach - bridges greedy and DP

5.
Add OneCodeforcesmedium

Classic digit DP that naturally shows overlapping subproblems

6.
Jump GameLeetCodemedium

Variable jumps and memoization combine to show how pruning works

7.
Coin ChangeLeetCodehard

Unbounded coins hit the same subproblems repeatedly, making memoization essential

8.

Teaches cost optimization in climbing stairs pattern with choice

9.
Climbing StairsLeetCodeeasy

Naive recursion times out, but adding one memo layer makes it instant - the DP awakening

10.
House RobberLeetCodemedium

Teaches you how to compress O(n) space down to O(1) using just two variables

11.
Decode WaysLeetCodemedium

String branching with memoization shows why top-down DP feels natural

Ready to start learning?

Access all 45 lessons with interactive content and progress tracking.