Tags

Memoization

Memoization

1 lesson
3 problems
2 code snippets
2 question banks
7 community items

memoization

Algorithms

1 lesson

Dynamic Programming (Intro)

Intermediate

75 min

1 prereq

Naive recursive Fibonacci computes `fib(40)` in seconds, `fib(50)` in minutes, and gives up on `fib(60)`, all because it recomputes the same subproblems exponentially many times. Cache the result of each `fib(k)` the first time you compute it and the same recursion runs in linear time. That single change, remembering answers, is the entire content of dynamic programming. **Dynamic Programming (Intro)** turns that observation into a complete problem-solving framework. You will identify overlapping subproblems and optimal substructure (the two properties a problem must have for DP to apply), and master both approaches: top-down memoization (recursion plus a cache) and bottom-up tabulation (iteratively filling a table). Classic 1D problems include Fibonacci, climbing stairs, coin change, house robber, and a first look at Kadane's algorithm. The lesson teaches you to define state precisely ("what does `dp[i]` represent?"), write the transition ("how does `dp[i]` follow from earlier states?"), set base cases, and apply rolling-variable space optimization that drops `O(n)` to `O(1)`. In **Recursion Fundamentals**, you treated each recursive call as a stack frame. Memoization just attaches a cache so identical inputs return immediately. Next, **Bit Manipulation (Intro)** turns to a different toolkit, where bitwise operators give elegant `O(1)` solutions.

Not Started

0%

Algorithms
Dynamic Programming
Memoization
Tabulation
Recursion
Fibonacci
Coin Change
Intermediate
Premium

Practice Problems

3 problems

Climbing Stairs

Free
Not Started
Easy

Given n steps, find the number of distinct ways to climb to the top when you can take 1 or 2 steps at a time.

Dynamic Programming
Tabulation
Memoization
Fibonacci
Beginner

448

8

Longest Increasing Path in a Matrix

Not Started
Hard

Given an m x n integer matrix, find the length of the longest strictly increasing path where you can move in four directions.

Dynamic Programming
Memoization
DFS
Matrix Traversal
Advanced

337

9

House Robber

Free
Not Started
Medium

Given an array representing the amount of money in each house along a street, determine the maximum amount you can rob without robbing two adjacent houses.

Dynamic Programming
Tabulation
Memoization
Algorithms
Intermediate

322

4

Question Banks

2 items
Question Bank

Dynamic Programming Warm-Up

Memoization, tabulation, and writing transitions for classic 1D DP. Code stems are Python.

Python
dynamic-programming
memoization
fundamentals
quiz

426

12

Easy
Question Bank
Premium

React Performance Optimization Quiz

Five drills on memoization, stable references, PureComponent, and the trade-offs between fixing a real render-cost problem and prematurely wrapping everything in memo.

JavaScript
quiz
react
performance-optimization
memoization

1k

8

Hard

Community

7 items
Code Snippet

Why My Context Provider Was Re-rendering Everything

We added a flame-graph and saw every consumer of `<UserContext>` re-rendering on every keystroke in a sibling. The fix took two days to isolate and three lines to ship.

JavaScript
react
hooks
memoization
performance-optimization

538

5

4.4 (12)

May 1, 2026

by @amiraprice

Article

Space Complexity, the Other Half of the Story

Auxiliary vs input space, the recursion-stack trap, the time-vs-space trade, and the two questions I added to my code-review template after one OOM in production.

space-complexity
time-complexity
asymptotic-analysis
fundamentals
memoization

598

8

4.4 (14)

Apr 27, 2026

by @erikbrooks

Problem
Hard
$8.99

Word Break II

Return every sentence that can be formed by space-segmenting a string into dictionary words, using memoized DFS keyed by start index.

dynamic-programming
memoization
strings
backtracking

734

12

Apr 12, 2026

by @lunamitchell

Article

Dynamic Programming Patterns

A 5-step framework that turns DP from magic into a checklist, the six recurring patterns, and the memoization-vs-tabulation decision that hides every space optimization.

dynamic-programming
memoization
tabulation
algorithms
interview-prep

340

2

Jan 23, 2026

by @ryanjoshi

Code Snippet

When `memo` Actually Stops a Re-render (and When It Does Not)

I once added React.memo everywhere and renders barely changed. Memo only works under specific conditions, and outside those it is dead weight. Three accordions on the trap and the fix.

JavaScript
react
hooks
memoization
performance-optimization

978

7

4.2 (12)

Jan 8, 2026

by @ananyaadeyemi

Question Bundle
$9.99

DP Questions I Saw Coming and Still Missed

Four DP problems I recognized in the interview and still got wrong. Coin change with the wrong order of loops, LIS in O(n^2), edit distance with a missing base case, and a 2D grid DP with overcounted moves.

Python
algorithms
dynamic-programming
memoization
interview-prep

318

7

4.3 (12)

Nov 30, 2025

by @hannahdelgado

Code Snippet

Memoize With TTL and Bounded Cache Size

The official memoize is unbounded and has no TTL, which works in tests and leaks memory in production. This is the version I ship: bounded LRU + per-entry expiry, in 40 lines.

JavaScript
memoization
lru-cache
ttl

1k

11

4.6 (10)

Nov 27, 2025

by @jordandubois