KatInterview

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 91–120 of 137 results

  • 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 ProgrammingMediumModel answer
    Maximum Valid-Partition Block Count for Every Prefix

    For each prefix of a string, find the maximum number of contiguous blocks it can be split into where every character in a block shares the same frequency.

    Dynamic Programmingdynamic programmingstringsfrequency countingprefix processing
  • 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 ProgrammingMediumModel answer
    0/1 Knapsack: Space-Efficient DP with Item Recovery

    Implement a weight-capacity optimizer returning max value and an exact item set, using O(W) space DP, then extend to unbounded and bounded variants.

    Dynamic Programmingdynamic-programmingknapsackreconstructionoptimization
  • Dynamic ProgrammingMediumModel answer
    Flappy Bird Auto-Pilot with Lookahead Planning

    Design a physics-based agent that decides when to jump by projecting future trajectories and checking collision-free paths through upcoming obstacles.

    Dynamic Programminggame-physicssimulationtrajectory-planning
  • 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
  • Dynamic ProgrammingMediumAuto-graded
    Split-or-Enumerate Symbol Sequence Decoder

    Tests string parsing, memoized backtracking, and combinatorial enumeration by decoding a symbol-encoded message with either explicit or missing letter boundaries.

    Dynamic Programmingstringsdynamic-programmingbacktracking
  • Dynamic ProgrammingMediumAuto-graded
    Tile a Word Using a Vocabulary List

    Tests whether a candidate can apply forward-reachability DP with a trie to decide if a string can be fully covered by vocabulary words end-to-end.

    Dynamic Programmingdynamic-programmingstringstrie
  • Dynamic ProgrammingHardModel answer
    Balance Mixed Bracket Types with Minimum Deletions

    Delete the fewest bracket characters to make all remaining brackets properly matched and nested, keeping all non-bracket characters intact.

    Dynamic Programmingdynamic-programmingstringsinterval-dp
  • Dynamic ProgrammingMediumAuto-graded
    Check if Text Can Be Built from Dictionary Words

    Tests dynamic programming with Trie optimization to determine if a string can be fully decomposed into a sequence of dictionary words.

    Dynamic Programmingtriestring-processingmemoization
  • Dynamic ProgrammingMediumAuto-graded
    Expected Wait Time and Coin Combination Counting

    Tests probability reasoning with independent random events and dynamic programming for combinatorial counting with unlimited resources.

    Dynamic Programmingprobabilityexpected-valuecombinatoricsunbounded-knapsack
  • Dynamic ProgrammingHardAuto-graded
    Minimum Cost to Multiply a Chain of Matrices

    Tests interval dynamic programming by finding the least expensive way to parenthesize consecutive matrix multiplications.

    Dynamic Programminginterval-dpoptimizationmemoization
  • Dynamic ProgrammingMediumAuto-graded
    Find Lexicographically Smallest Expression to Match Target

    Tests interval dynamic programming to build fully parenthesized expressions using all numbers in order with +, -, * operators to reach a target value.

    Dynamic Programmingdynamic-programmingrecursionstrings
  • Dynamic ProgrammingMediumAuto-graded
    Grid Traversal with Sequential Waypoints

    Tests dynamic programming on a grid with diagonal moves, tracking reachable states column-by-column while enforcing waypoint visitation order.

    Dynamic Programminggriddpspace-optimization
  • Dynamic ProgrammingHardAuto-graded
    Best Profit from One or Two Stock Transactions

    Tests dynamic programming and greedy strategies to compute optimal profit from array-based buy/sell scheduling with transaction limits.

    Dynamic Programmingarraysgreedystate-machineoptimization
  • Dynamic ProgrammingMediumAuto-graded
    Optimize Work Schedule with Limited Day Swaps

    Tests dynamic programming with state tracking to maximize earnings from daily pay and streak bonuses while converting limited off-days to work-days.

    Dynamic Programmingdynamic-programmingstate-machineoptimization
  • Dynamic ProgrammingMediumAuto-graded
    String Reversal with Contiguous Subarray Extremes

    Tests string manipulation and dynamic programming through reversing text and finding optimal contiguous subarrays by sum and product.

    Dynamic Programmingarraysstringskadanesubarray
  • Dynamic ProgrammingMediumAuto-graded
    Pack Exactly K Items with Maximum Total Value

    Tests the candidate's ability to apply a 2D knapsack variant requiring exactly a fixed item count while maximizing value, combining count and capacity constraints via DP.

    Dynamic Programmingdynamic programmingknapsack2d dp
  • Dynamic ProgrammingHardAuto-graded
    Construct Arithmetic Expression Matching Target

    Tests subset enumeration with bitmask DP, binary expression tree generation, operator application with exact rational arithmetic, and combinatorial search.

    Dynamic Programmingbitmask-dprecursioncombinatorics
  • Dynamic ProgrammingMediumAuto-graded
    Maximum Profit from Two Stock Transactions

    Tests dynamic programming with state transitions to find optimal profit from up to two non-overlapping buy-sell trades given daily stock prices.

    Dynamic Programmingarraysstate-machineoptimization