practice a little every day — you've got this ♡
Dynamic Programming Interview Problems
Practice 5969 original coding, SQL, system design, machine learning and behavioral problems across 15 topics. Coding and SQL problems run against hidden test cases right in your browser; every problem has hints and a worked solution, free.
- 5969
- Problems
- 2211
- Auto-graded
- 15
- Topics
- 273
- Added today
Showing 1–30 of 120 results
- Dynamic ProgrammingMediumAuto-gradedProcess Morse Signals and Provider Coverage
Evaluate string encoding, ambiguous Morse code decoding via dynamic programming, and spatial coverage checking for network members.
Dynamic Programmingdynamic-programmingstringsarraysgeometry - Dynamic ProgrammingMediumAuto-gradedClimbing the Tallest Staircase Through a Height Map
Find the longest chain of strictly rising values in a grid using only up, down, left, right steps, which tests DP over an implicit DAG with a valid processing order.
Dynamic Programmingdynamic-programminggridtopological-ordermemoization - Dynamic ProgrammingHardAuto-gradedMaximize Priority Sum of Non-Overlapping Tasks
Find the maximum priority total achievable among non-overlapping interval tasks, prioritizing task count first then total priority.
Dynamic Programmingdynamic-programminggreedy-intervalsbinary-search - Dynamic ProgrammingMediumAuto-gradedBiggest Solid Block in a Binary Grid
Find the area of the largest square made only of '1' cells in a grid of character digits, using a dynamic programming recurrence that can be compressed to a single row of state.
Dynamic Programmingdynamic-programmingmatrixspace-optimization2d-grid - Dynamic ProgrammingHardAuto-gradedAdaptive Word Guessing Minimax Strategy
Find the minimum number of worst-case letter guesses required to isolate a hidden word against an adversarial host.
Dynamic Programmingdynamic-programmingbit-manipulationminimaxmemoization - Dynamic ProgrammingMediumAuto-gradedBest Final Score from Affine Card Purchases Under a Budget
Choose a budget-limited subset of cards and an order to maximize a score updated by an affine rule, testing subset and ordering search and exchange-argument reasoning.
Dynamic Programmingsubset-searchpermutationsexchange-argumentknapsack - Dynamic ProgrammingMediumAuto-gradedCounting Sorted Sequences With Prescribed Digit Sums
Count non-decreasing sequences of integers in [0, 5000] whose i-th element has a given digit sum, using DP over candidate values with prefix sums, modulo 1,000,000,007.
Dynamic Programmingdynamic-programmingprefix-sumstwo-pointerscounting - Dynamic ProgrammingHardAuto-gradedFewest Cabinets for Two-Resource Jobs
Group jobs with two resource demands into the fewest identical cabinets, using exact search with symmetry breaking and pruning (2D vector bin packing).
Dynamic Programmingbin-packingbacktrackingbitmaskcombinatorial-optimization - Dynamic ProgrammingMediumAuto-gradedProbability of Adjacent Car Groups in a Random Parking Row
Count placements of k items in n slots with at least m maximal runs of length 2 or more, using a counting DP or combinatorics, and return the exact probability.
Dynamic Programmingcombinatoricsprobabilitydynamic-programmingcounting - Dynamic ProgrammingMediumAuto-gradedShortest Nested Run-Length Encoding of a String
Find the shortest nested repeat encoding of a string with interval DP over splits and repeats, using a fixed tie-break order so the output is unique.
Dynamic Programmingdynamic-programmingstringsrecursionmemoization - Dynamic ProgrammingMediumAuto-gradedBest Haul from a Row of Cash Stations
Tests one-dimensional dynamic programming: pick values from a sequence so no two neighbors are both chosen, maximizing the total.
Dynamic Programmingdynamic-programmingarraysoptimization - Dynamic ProgrammingHardAuto-gradedCoin Pile Fusion: Who Makes the Last Merge?
Decide the winner of a two-player impartial game where piles are fused under a size cap, using memoized game-tree search over canonical multiset states.
Dynamic Programminggame-theorymemoizationbacktrackingbitmask-states - Dynamic ProgrammingMediumAuto-gradedBooth Assignment Plan: Cheapest Non-Repeating Color Sequence
Choose one of three colors per day to minimize total cost with no color on two adjacent days, then return the actual sequence using DP with backtracking.
Dynamic Programmingdynamic-programmingpath-reconstructionarrays - Dynamic ProgrammingMediumAuto-gradedMaximum Earnings from Back-to-Back Booking Slots
Pick non-overlapping time slots, where one may begin exactly as another finishes, to maximize total payout; tests weighted interval scheduling with sorting, DP and binary search.
Dynamic Programmingdynamic-programmingbinary-searchintervalssorting - Dynamic ProgrammingMediumAuto-gradedNearest Word Lookup Using Minimum Edit Operations
Compute Levenshtein distance with dynamic programming and pick, for each query, the closest dictionary word with a stable first-index tie-break.
Dynamic Programmingedit-distancedynamic-programmingstringstie-breaking - Dynamic ProgrammingMediumAuto-gradedCounting Knight-Walk Phone Numbers on a Keypad
Count length-n digit strings formed by knight jumps on a phone keypad, modulo 1e9+7, using DP over a small fixed graph.
Dynamic Programmingdynamic-programminggraphmodular-arithmeticcounting - Dynamic ProgrammingMediumAuto-gradedCount Reachable Totals from a Bounded Coin Collection
Count the distinct positive totals obtainable from a limited supply of coins per denomination, testing bounded subset-sum reachability with DP or bitset techniques.
Dynamic Programmingdynamic-programmingsubset-sumbounded-knapsackbitset - Dynamic ProgrammingMediumAuto-gradedPrime Segment Partitions of a Digit Sequence
Count the ways to cut a digit string into prime-valued pieces without leading zeros, using prefix dynamic programming plus a fast primality check, modulo 1,000,000,007.
Dynamic Programmingdynamic-programmingprimality-teststringscounting - Dynamic ProgrammingMediumAuto-gradedStop or Roll: Ten-Sided Die With a One-Time Reset
Decide whether to stop or roll in a dice accumulation game where the first zero resets your total and the second zero wipes you out, using DP over (total, reset-used) states.
Dynamic Programmingdynamic-programmingexpected-valueoptimal-stoppingprobability - Dynamic ProgrammingMediumAuto-gradedCalculate Processed Work Units in Pipelined Task Queues
Simulate task batch execution across a sequential multi-stage pipeline and count total units completed within a time limit.
Dynamic Programmingarrayssimulationdynamic-programminggreedy-intervals - Dynamic ProgrammingMediumAuto-gradedBest Haul from a Line of Stalls Without Neighbors
Compute the maximum total from a line of non-negative numbers when no two neighboring entries may both be picked, using linear-time dynamic programming.
Dynamic Programmingdynamic-programmingarraytake-or-skiphouse-robber - Dynamic ProgrammingHardAuto-gradedDaily Vendor Booking with No Immediate Repeats
Choose one vendor per day to minimize total price with no vendor on consecutive days, returning the plan with a fixed tie-break; tests DP, backtracking, and best/second-best.
Dynamic Programmingdynamic-programmingpath-reconstructionoptimizationarrays - Dynamic ProgrammingMediumAuto-gradedSmallest Sentence from a Spaceless String and Word List
Segment a spaceless string into dictionary words and return the lexicographically smallest valid sentence, or None if impossible; tests suffix DP plus greedy reconstruction.
Dynamic Programmingdynamic-programmingstringsgreedyword-break - Dynamic ProgrammingMediumAuto-gradedLongest Eastward Chain of Cities from Raw CSV Text
Parse CSV text with quoted fields, then find the longest chain of cities with increasing longitude and non-decreasing latitude, breaking ties by the smallest list of names.
Dynamic Programmingcsv-parsinglongest-increasing-subsequencedag-dplexicographic-tiebreak - Dynamic ProgrammingMediumAuto-gradedOptimal Closed Tour Cost Across Directed Locations
Find the minimum cost to complete a full circuit starting and ending at node 0, visiting all other nodes exactly once with asymmetric leg costs.
Dynamic Programmingdynamic-programmingbit manipulationgraph - Dynamic ProgrammingMediumAuto-gradedStock Trading With a Per-Sale Commission
Compute the best total gain from repeatedly buying and selling a single share of a stock when each sale costs a flat commission, using a two-state dynamic program.
Dynamic Programmingdynamic-programmingstate-machinestocksgreedy - Dynamic ProgrammingMediumAuto-gradedRearrangements of 1..m With a Fixed Number of Out-of-Order Pairs
Count arrangements of 1..m with exactly n out-of-order pairs, modulo 10^9+7, using a DP over insertion positions optimized with a sliding-window sum.
Dynamic Programmingdynamic-programmingcombinatoricspermutationssliding-window - Dynamic ProgrammingHardAuto-gradedBalanced Parentheses After Digit-Driven Removals
Decide whether removing parentheses to satisfy per-digit quotas can leave a balanced bracket string, using a DP over balance and removal count.
Dynamic Programmingdynamic-programmingstringsparenthesesstate-compression - Dynamic ProgrammingEasyAuto-gradedBankrupt Risk in Dice Game
Compute the exact probability of wealth hitting zero or below at any step during a finite sequence of random dice rolls.
Dynamic Programmingdynamic-programmingmath-bitsstatistics - Dynamic ProgrammingMediumAuto-gradedCheapest Daily Ticket Plan Without Back-to-Back Repeats
Choose one of three item types each day with no type repeated on adjacent days, minimizing total cost and returning the unique optimal sequence of choices.
Dynamic Programmingdynamic-programmingpath-reconstructionpaint-house