practice a little every day — you've got this ♡
Dynamic Programming Interview Problems
Practice 5971 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.
- 5971
- Problems
- 2211
- Auto-graded
- 15
- Topics
- 272
- Added today
Showing 61–90 of 120 results
- Dynamic ProgrammingMediumAuto-gradedMaximum Expected Value from Sequential Uniform Draws
Tests understanding of optimal stopping via backward induction and dynamic threshold computation.
Dynamic Programmingoptimal-stoppingbackward-inductionexpected-value - Dynamic ProgrammingHardAuto-gradedCheapest Round-Trip Inspection Tour
Tests bitmask dynamic programming (Held–Karp) to find the minimum-cost Hamiltonian cycle in a small directed weighted graph.
Dynamic Programmingbitmask-dptraveling-salesmangraphs - Dynamic ProgrammingMediumAuto-gradedCount Paths of Fixed Length in a DAG
Tests dynamic programming on graphs, topological ordering, and systematic state-space enumeration with path-length constraints.
Dynamic Programminggraphstopological-sortdag2d-dp - Dynamic ProgrammingMediumAuto-gradedBest Path Sum in Triangle with Required Cell Constraint
Computes the maximum path sum descending through a triangular grid, both unconstrained and when forced through a specific cell.
Dynamic Programmingdynamic-programmingpathsoptimization - Dynamic ProgrammingMediumAuto-gradedFewest Items to Hit an Exact Weight Target
Tests whether a candidate can apply 0/1 knapsack DP to find the minimum number of items from a list whose weights sum to exactly a given target.
Dynamic Programmingdynamic-programmingknapsackarrays - Dynamic ProgrammingMediumAuto-gradedMaximum Reward Within a Spending Limit
Tests whether a candidate can apply 0/1 knapsack dynamic programming to maximize total reward without exceeding a fixed spending cap.
Dynamic Programmingdynamic-programmingknapsackoptimization - Dynamic ProgrammingMediumAuto-gradedMinimum Coins to Reach a Money Amount
Tests dynamic programming on a coin-change problem where decimal monetary values must be safely converted to integers before solving.
Dynamic Programmingdynamic-programmingdecimal-precisioncoin-change - Dynamic ProgrammingMediumAuto-gradedLargest Sum in Any Consecutive Sequence
Tests understanding of dynamic programming through finding the maximum sum achievable by selecting adjacent elements from an array.
Dynamic Programmingarrayskadanesubarrayoptimization - Dynamic ProgrammingMediumAuto-gradedScore Bust Probability: Stop When You Hit the Target
Tests whether a candidate can build an O(n) sliding-window DP to compute the probability that a random accumulation process stops within a given score ceiling.
Dynamic Programmingdynamic-programmingsliding-windowprobability - Dynamic ProgrammingMediumAuto-gradedCompact RLE Coder: Decode a String and Re-encode Under Pattern Limit
Tests string parsing for RLE decoding and interval DP to find the shortest valid re-encoding when patterns are capped at length K.
Dynamic Programmingstringsdynamic-programmingcompression - Dynamic ProgrammingHardAuto-gradedEnumerate All Possible Tic-Tac-Toe Game Paths
Tests recursive game-tree traversal with memoization to count distinct play sequences by outcome.
Dynamic Programmingrecursionmemoizationgame-theory - Dynamic ProgrammingMediumAuto-gradedLongest Strictly Increasing Subsequence
Tests understanding of dynamic programming optimization using binary search and greedy subsequence construction with the patience sorting technique.
Dynamic Programmingbinary-searchsubsequencesgreedy - Dynamic ProgrammingMediumAuto-gradedWorst Equity Drop, Best Trade, and Fewest Coins
Return a series' steepest peak-to-trough drop with its indices, the best one-buy-one-sell gain, and the minimum coin count for a target.
Dynamic Programmingarraysdynamic-programminggreedysingle-pass - Dynamic ProgrammingMediumAuto-gradedMinimize Payment Transfers to Balance Group Accounts
Tests backtracking with memoization to find the smallest number of payments needed to settle net balances across multiple participants.
Dynamic Programmingbacktrackingmemoizationcombinatorial-search - Dynamic ProgrammingHardAuto-gradedExpected Steps to Deplete Whole Pills from a Random Draw Process
Tests modeling a stochastic process as a Markov chain and solving it with dynamic programming using conditional expectation.
Dynamic Programmingprobabilityexpectationmarkov-chainrecurrence - Dynamic ProgrammingMediumAuto-gradedSum of All-One Squares in a Binary Grid
Tests dynamic programming on 2D grids by computing the total count of square submatrices containing only ones.
Dynamic Programmingdynamic-programmingmatrices2d-dp - Dynamic ProgrammingHardAuto-gradedBuild Arithmetic Expressions That Hit a Target Value
Tests backtracking with incremental precedence-aware evaluation to enumerate all +/* expressions over a number sequence that sum to a given target.
Dynamic Programmingbacktrackingrecursionoperator-precedence - Dynamic ProgrammingMediumAuto-gradedPack Expedition Gear Within Weight and Volume Limits
Tests the 2-constraint (weight + volume) knapsack variant using DP with memoization or tabulation to maximize the total utility of selected gear items.
Dynamic Programmingdynamic programmingknapsackmemoization - Dynamic ProgrammingHardAuto-gradedMaximize Hourly Output Revenue for a Three-Stage Assembly Line
Tests budgeted 0/1 selection with a bottleneck objective, requiring Pareto-frontier pruning over a four-dimensional knapsack state space.
Dynamic Programmingknapsackpareto-frontierbottleneckcombinatorial-optimization - Dynamic ProgrammingMediumAuto-gradedSmallest Venue Set That Fits a Group
Tests capacity-constrained subset selection with multi-level tie-breaking: fewest venues, then minimum total capacity, then lexicographically smallest ID list.
Dynamic Programmingdynamic-programmingsubset-sumcombinatorics - Dynamic ProgrammingMediumAuto-gradedPrime-Step Path Score + Bottleneck Throughput Boost
Tests DP over prime-length jumps on an array and binary search on a "maximize the minimum" pipeline scaling problem, combined into one function.
Dynamic Programmingdynamic-programmingbinary-searchnumber-theory - Dynamic ProgrammingMediumAuto-gradedFind Maximum Strictly Ascending Subsequence Length
Tests dynamic programming optimization using binary search to efficiently compute the longest strictly increasing subsequence in O(n log n) time.
Dynamic Programmingbinary-searchsubsequencesgreedy - Dynamic ProgrammingMediumAuto-gradedWays to Decode a Numeric String into Letters
Tests dynamic programming reasoning on sequential digit-to-letter mappings, including careful handling of zeros and invalid two-digit pairs.
Dynamic Programmingdynamic-programmingstringsrecursion - Dynamic ProgrammingMediumAuto-gradedBest Revenue from Selling Rod Segments
Tests dynamic programming by finding the optimal way to partition a rod into segments to maximize total selling price.
Dynamic Programmingdynamic-programmingoptimizationunbounded-knapsack - Dynamic ProgrammingMediumAuto-gradedMaximum Score With No Two Adjacent Drops
Tests whether a candidate can model a pick/skip DP with a "no two consecutive skips" constraint using O(1) space and O(n) time.
Dynamic Programmingdynamic-programmingarraysgreedy - Dynamic ProgrammingHardAuto-gradedCount Parity-Alternating Subsequences
Tests dynamic programming with state tracking to count subsequences where consecutive elements alternate between even and odd values.
Dynamic Programmingdynamic-programmingsubsequencesparitymodular-arithmetic - Dynamic ProgrammingMediumAuto-gradedMaximum Profit Under Capacity Constraint
Tests understanding of 0/1 knapsack disguised by a misleading ordering constraint that is actually always satisfiable.
Dynamic Programmingknapsackdynamic-programminggreedy - Dynamic ProgrammingMediumAuto-gradedPartition Items Into Bins With Limited Capacity
Tests the classic bounded knapsack variant where you must determine the minimum number of identical bins needed so each bin's total weight stays within a capacity, using DP to check feasibility.
Dynamic Programmingdynamic programmingknapsackmemoization - Dynamic ProgrammingHardAuto-gradedCount Sorted Sequences Matching Per-Position Digit Sums
Tests dynamic programming over value buckets with a two-pointer prefix-sum transition to count sorted integer sequences under a digit-sum constraint.
Dynamic Programmingdynamic-programmingarraysmath-bits - Dynamic ProgrammingMediumAuto-gradedCount Tile-Filling Combinations for a Target Length
Tests unbounded-knapsack DP by counting unordered multisets of tile widths, drawn from a given list, that sum exactly to a target corridor length.
Dynamic Programmingdynamic-programmingcombinatoricsunbounded-knapsack