Dynamic Programming and High-Frequency Interviews Python practice problems
Finish with high-frequency dynamic programming, grid, graph-ordering, and sliding-window problems.
Core concepts
Problem-solving patterns
- Define state → recurrence → base cases → evaluation order
Reported company tags
All 20 problems in this topic
Work from top to bottom to build the concept gradually.
- #241Count ways to climb stairs: Five stairsInterviewPremium
Count different one-step and two-step sequences that reach stair five.
- #242Count ways to climb stairs: Zero stairsInterviewPremium
There is one way to remain at the starting point: take no steps.
- #243Maximize nonadjacent house loot: Alternating opportunityInterviewPremium
Find the maximum value without choosing adjacent houses.
- #244Maximize nonadjacent house loot: Two housesInterviewPremium
Choose the larger value when the only two houses are adjacent.
- #245Find minimum coins: Reachable amountInterviewPremium
Find the fewest coins needed to make eleven.
- #246Find minimum coins: Impossible amountInterviewPremium
Return -1 when no combination can form the requested amount.
- #247Solve 0/1 knapsack: Choose best packageInterviewPremium
Maximize value under a small carrying capacity.
- #248Solve 0/1 knapsack: No item fitsInterviewPremium
Return zero when every item is heavier than the capacity.
- #249Find longest increasing subsequence length: Mixed sequenceInterviewPremium
Find the LIS length in a common interview example.
- #250Find longest increasing subsequence length: Strictly decreasingInterviewPremium
Only one value can belong to a strictly increasing subsequence.
- #251Find longest common subsequence length: Shared subsequenceInterviewPremium
Find the LCS length for two strings with characters in common order.
- #252Find longest common subsequence length: No common charactersInterviewPremium
Return zero when the strings share no character.
- #253Calculate edit distance: Classic conversionInterviewPremium
Find the minimum edits needed to convert kitten to sitting.
- #254Calculate edit distance: Empty targetInterviewPremium
Deleting every source character is optimal when the target is empty.
- #255Find longest substring without repeats: Mixed repeatsInterviewPremium
Find the longest unique-character window in a common example.
- #256Find longest substring without repeats: All same characterInterviewPremium
A string of identical characters has best window length one.
- #257Count islands in a grid: Three islandsInterviewPremium
Count separate land regions in a small map.
- #258Count islands in a grid: All waterInterviewPremium
Return zero when the grid contains no land.
- #259Topologically sort tasks: Valid build orderInterviewPremium
Produce one valid order for tasks with prerequisites.
- #260Topologically sort tasks: Cyclic dependenciesInterviewPremium
Report Cycle when no complete topological order exists.