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 120 results

  • 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 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
  • Dynamic ProgrammingHardAuto-graded
    Peak Subsequence Maximum Sum

    Tests dynamic programming with coordinate compression and Fenwick trees to efficiently compute optimal bitonic subsequences.

    Dynamic Programmingdynamic-programmingfenwick-treecoordinate-compressionbitonic-sequence
  • Dynamic ProgrammingHardAuto-graded
    Minimum-Cost Path with Fuel Stops on a Grid

    Tests grid DP with an extra state dimension: navigate an N×M grid from top-left to bottom-right tracking remaining fuel, refueling at marked cells, minimizing total toll cost.

    Dynamic Programmingdynamic programminggridstatememoization
  • Dynamic ProgrammingHardAuto-graded
    Path Sum with Conditional Prime Shortcuts

    Tests dynamic programming with number theory constraints, combining sequential traversal with prime-offset jumps that depend on target cell properties.

    Dynamic Programmingdynamic-programmingnumber-theoryarrays
  • Dynamic ProgrammingMediumAuto-graded
    Select Numbers to Maximize Score with Neighbor Elimination

    Tests dynamic programming on sparse integers and hash map frequency counting to find the optimal subset when adjacent values conflict.

    Dynamic Programminghash-mapsortinghouse-robber-variant
  • Dynamic ProgrammingMediumAuto-graded
    Maximum Length of Mirror Subsequence

    Tests dynamic programming on strings to find the longest subsequence that is identical when reversed.

    Dynamic Programmingdynamic-programmingstringssubsequences
  • Dynamic ProgrammingMediumAuto-graded
    Minimum Cost to Transform One String into Another

    Tests string DP by computing the minimum total cost to convert a source string into a target string using per-character insert, delete, and replace operations with custom costs.

    Dynamic Programmingdynamic programmingstringedit distance
  • Dynamic ProgrammingMediumAuto-graded
    Minimum Tokens to Reach a Score: Reusable vs. One-Time Use

    Tests whether a candidate can implement both unbounded and 0/1 knapsack DP to find the smallest number of tokens that sum exactly to a target.

    Dynamic Programmingdynamic-programmingknapsackbottom-up-dp
  • Dynamic ProgrammingEasyAuto-graded
    Count Paths Through a Grid with Blocked Cells

    Tests whether a candidate can apply bottom-up DP on a 2-D grid to count reachable paths from top-left to bottom-right while respecting blocked cells.

    Dynamic Programmingdynamic programminggridpaths
  • Dynamic ProgrammingHardAuto-graded
    Find Minimum Cost to Multiply a Chain of Matrices

    Tests dynamic programming on interval optimization, optimal substructure, and avoiding greedy pitfalls in matrix multiplication ordering.

    Dynamic Programmingdynamic-programmingoptimizationrecursion
  • Dynamic ProgrammingHardAuto-graded
    Minimum Cost to Merge Stone Piles

    Tests interval DP by finding the minimum total cost to merge an array of stone piles into one, where merging any contiguous segment costs the sum of that segment.

    Dynamic Programmingdynamic programminginterval DPmemoization
  • Dynamic ProgrammingEasyAuto-graded
    Minimum Cost to Type a String on a Circular Keyboard

    Tests string DP by computing the minimum total movement cost to type a target string on a circular letter wheel, starting from a given letter.

    Dynamic Programmingdynamic programmingstring DPgreedy
  • Dynamic ProgrammingMediumAuto-graded
    Collect Gems in a Grid with Fatigue Penalty

    Tests grid-path DP with a carried state (fatigue level) that penalizes consecutive moves in the same direction, requiring careful state-space design and memoization.

    Dynamic Programmingdynamic programminggridmemoizationstate machine
  • Dynamic ProgrammingMediumAuto-graded
    Maximize Museum Tour Value With Energy Budget

    Tests the 0/1 knapsack variant where you allocate a fixed energy budget across museum exhibits with costs and values, but some exhibits are only accessible after visiting a prerequisite.

    Dynamic Programmingdynamic programmingknapsackprerequisites
  • Dynamic ProgrammingEasyAuto-graded
    Minimum Cost to Visit All Booths at a Fair

    Tests bitmask DP on small n by finding the minimum total travel cost to visit every booth at a fair, starting and ending at the entrance.

    Dynamic Programmingdynamic programmingbitmask DPgraphs
  • Dynamic ProgrammingHardAuto-graded
    Collect Keys on a Grid with Locked Doors

    Tests grid-path DP where the traveler must collect keys to unlock doors, requiring bitmask state to track which keys have been picked up.

    Dynamic Programmingdynamic programmingbitmaskgridBFS/DP
  • Dynamic ProgrammingEasyAuto-graded
    Fill a Backpack With Exactly K Item Types

    Tests whether a candidate can apply 0/1 knapsack DP to determine the maximum total value achievable by selecting items that collectively use exactly K distinct item types within a weight budget.

    Dynamic Programmingdynamic programmingknapsackmemoization
  • Dynamic ProgrammingMediumAuto-graded
    Minimum Cost to Visit All Checkpoints

    Tests bitmask DP over a small set of checkpoints to find the minimum-cost path that visits every checkpoint exactly once, starting and ending at a fixed depot.

    Dynamic Programmingdynamic programmingbitmask DPgraphs