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

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

    Auto-gradeddynamic-programmingfenwick-treecoordinate-compressionbitonic-sequence
  • 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.

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

    Auto-gradeddynamic-programmingnumber-theoryarrays
  • Tests dynamic programming on sparse integers and hash map frequency counting to find the optimal subset when adjacent values conflict.

    Auto-gradedhash-mapsortinghouse-robber-variant
  • Tests dynamic programming on strings to find the longest subsequence that is identical when reversed.

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

    Auto-gradeddynamic programmingstringedit distance
  • 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.

    Auto-gradeddynamic-programmingknapsackbottom-up-dp
  • 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.

    Auto-gradeddynamic programminggridpaths
  • Tests dynamic programming on interval optimization, optimal substructure, and avoiding greedy pitfalls in matrix multiplication ordering.

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

    Auto-gradeddynamic programminginterval DPmemoization
  • 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.

    Auto-gradeddynamic programmingstring DPgreedy
  • 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.

    Auto-gradeddynamic programminggridmemoizationstate machine
  • 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.

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

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

    Auto-gradeddynamic programmingbitmaskgridBFS/DP
  • 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.

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

    Auto-gradeddynamic programmingbitmask DPgraphs

More topics