← PATTERN ATLAS
PATTERN 12 · 13 PROBLEMS

Dynamic programming

Name a repeated subproblem, define its answer, and build larger answers from smaller ones.

Start the first lesson ↗
MASTER KEYState is the smallest information needed to finish.
0OF 13
RECALLED
RECOGNITION SIGNAL

Ways at n equal ways at n−1 plus ways at n−2.

01
Not started

Climbing Stairs

Ways at n equal ways at n−1 plus ways at n−2.

↗
02
Not started

House Robber

At each house choose between skipping it and taking it plus the best two back.

↗
03
Not started

House Robber II

First and last cannot both be used, so split into two linear cases.

↗
04
Not started

Longest Palindromic Substring

Every palindrome expands from one character or one gap.

↗
05
Not started

Palindromic Substrings

Each successful center expansion corresponds to one distinct substring occurrence.

↗
06
Not started

Decode Ways

A position can be reached from one valid digit or one valid two-digit number.

↗
07
Not started

Coin Change

Each amount depends on smaller amounts reached by removing one coin.

↗
08
Not started

Maximum Product Subarray

A negative value swaps the roles of largest and smallest ending products.

↗
09
Not started

Word Break

A prefix is solvable if some earlier solvable cut is followed by a dictionary word.

↗
10
Not started

Longest Increasing Subsequence

The smallest possible tail for each length leaves maximum room to extend.

↗
11
Not started

Unique Paths

Ways to a cell equal ways from above plus ways from left.

↗
12
Not started

Longest Common Subsequence

Matching characters extend the diagonal answer; mismatches drop one side.

↗
13
Not started

Combination Sum IV

Order matters, so every final choice extends all sequences for the remaining amount.

↗