KatInterview

Topic

Dynamic Programming interview problems

States, transitions and memoization on sequences and grids. 137 original problems, each with hidden test cases you can run in the browser.

Problems137

5 easy96 medium36 hard

Showing 91–120 of 137 results

  • Tests the 2-constraint (weight + volume) knapsack variant using DP with memoization or tabulation to maximize the total utility of selected gear items.

    Auto-gradeddynamic programmingknapsackmemoization
  • Tests budgeted 0/1 selection with a bottleneck objective, requiring Pareto-frontier pruning over a four-dimensional knapsack state space.

    Auto-gradedknapsackpareto-frontierbottleneckcombinatorial-optimization
  • 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.

    Model answerdynamic programmingstringsfrequency countingprefix processing
  • Tests capacity-constrained subset selection with multi-level tie-breaking: fewest venues, then minimum total capacity, then lexicographically smallest ID list.

    Auto-gradeddynamic-programmingsubset-sumcombinatorics
  • Tests DP over prime-length jumps on an array and binary search on a "maximize the minimum" pipeline scaling problem, combined into one function.

    Auto-gradeddynamic-programmingbinary-searchnumber-theory
  • Tests dynamic programming optimization using binary search to efficiently compute the longest strictly increasing subsequence in O(n log n) time.

    Auto-gradedbinary-searchsubsequencesgreedy
  • Tests dynamic programming reasoning on sequential digit-to-letter mappings, including careful handling of zeros and invalid two-digit pairs.

    Auto-gradeddynamic-programmingstringsrecursion
  • Tests dynamic programming by finding the optimal way to partition a rod into segments to maximize total selling price.

    Auto-gradeddynamic-programmingoptimizationunbounded-knapsack
  • 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.

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

    Model answergame-physicssimulationtrajectory-planning
  • 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.

    Auto-gradeddynamic-programmingarraysgreedy
  • Tests dynamic programming with state tracking to count subsequences where consecutive elements alternate between even and odd values.

    Auto-gradeddynamic-programmingsubsequencesparitymodular-arithmetic
  • Tests understanding of 0/1 knapsack disguised by a misleading ordering constraint that is actually always satisfiable.

    Auto-gradedknapsackdynamic-programminggreedy
  • 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.

    Auto-gradeddynamic programmingknapsackmemoization
  • Tests dynamic programming over value buckets with a two-pointer prefix-sum transition to count sorted integer sequences under a digit-sum constraint.

    Auto-gradeddynamic-programmingarraysmath-bits
  • Tests unbounded-knapsack DP by counting unordered multisets of tile widths, drawn from a given list, that sum exactly to a target corridor length.

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

    Auto-gradedstringsdynamic-programmingbacktracking
  • 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.

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

    Model answerdynamic-programmingstringsinterval-dp
  • Tests dynamic programming with Trie optimization to determine if a string can be fully decomposed into a sequence of dictionary words.

    Auto-gradedtriestring-processingmemoization
  • Tests probability reasoning with independent random events and dynamic programming for combinatorial counting with unlimited resources.

    Auto-gradedprobabilityexpected-valuecombinatoricsunbounded-knapsack
  • Tests interval dynamic programming by finding the least expensive way to parenthesize consecutive matrix multiplications.

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

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

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

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

    Auto-gradeddynamic-programmingstate-machineoptimization
  • Tests string manipulation and dynamic programming through reversing text and finding optimal contiguous subarrays by sum and product.

    Auto-gradedarraysstringskadanesubarray
  • 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.

    Auto-gradeddynamic programmingknapsack2d dp
  • Tests subset enumeration with bitmask DP, binary expression tree generation, operator application with exact rational arithmetic, and combinatorial search.

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

    Auto-gradedarraysstate-machineoptimization

More topics