KatInterview

practice a little every day — you've got this ♡

Dynamic Programming Interview Problems

Practice 5966 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.

5966
Problems
2209
Auto-graded
15
Topics
271
Added today

Showing 121–137 of 137 results

  • 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