KatInterview

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-graded
    Maximum 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-graded
    Cheapest 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-graded
    Count 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-graded
    Best 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-graded
    Fewest 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-graded
    Maximum 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-graded
    Minimum 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-graded
    Largest 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-graded
    Score 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-graded
    Compact 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-graded
    Enumerate 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-graded
    Longest 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-graded
    Worst 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-graded
    Minimize 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-graded
    Expected 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-graded
    Sum 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-graded
    Build 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-graded
    Pack 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-graded
    Maximize 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-graded
    Smallest 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-graded
    Prime-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-graded
    Find 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-graded
    Ways 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-graded
    Best 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-graded
    Maximum 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-graded
    Count 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-graded
    Maximum 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-graded
    Partition 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-graded
    Count 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-graded
    Count 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