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 31–60 of 120 results
- Dynamic ProgrammingHardAuto-gradedTrim Letters to Reach a Mirror String Within a Budget
Decide whether a string can become a palindrome after removing no more than k characters, testing interval dynamic programming and palindromic subsequence reasoning.
Dynamic Programmingdynamic-programmingpalindromestringssubsequence - Dynamic ProgrammingMediumAuto-gradedCount Step Sequences with Custom Prime Jumps
Find the number of unique sequences of steps to reach a target using 1-unit steps or prime steps ending in digit 3.
Dynamic Programmingdynamic-programmingmathsievemodular-arithmetic - Dynamic ProgrammingMediumAuto-gradedPair Workers With Distinct Stations at Minimum Grid Distance
Match each point in one list to a different point in a larger list so the total Manhattan distance is minimal, which suits a bitmask DP given the small limits.
Dynamic Programmingbitmask-dpassignment-problemmanhattan-distance - Dynamic ProgrammingMediumAuto-gradedSmallest Fully Bracketed Arithmetic Expression Hitting a Target
Enumerate all operator and bracket choices over an ordered list of numbers and return the ASCII-smallest canonical expression that evaluates to the target, or an empty string.
Dynamic Programmingrecursioninterval-dpexpression-treesmemoization - Dynamic ProgrammingHardAuto-gradedVisit Every Node Exactly Once: Path Existence in a Small Graph
Decide whether an undirected graph of at most 20 vertices has a simple path through every vertex, which is best solved with a bitmask DP over visited subsets.
Dynamic Programmingbitmask-dpgraphhamiltonian-pathsubsets - Dynamic ProgrammingMediumAuto-gradedFull-String Matching With Single and Multi Character Wildcards
Decide whether a pattern containing '?' and '*' wildcards matches an entire string, testing dynamic programming or greedy two-pointer matching with backtracking.
Dynamic Programmingstringswildcard-matchingdynamic-programminggreedy - Dynamic ProgrammingHardAuto-gradedMinimal Coin Exchange with Overpayment
Find the minimum combined count of paid and received coins to settle a precise target value using dynamic programming.
Dynamic Programmingdynamic-programmingarrays - Dynamic ProgrammingHardAuto-gradedCount and Score Conflict-Free Cap Distributions
Count the ways to give each person a distinct acceptable item and find the best total value, using a bitmask DP over people or bounded backtracking.
Dynamic Programmingbitmask-dpcountingbacktrackingassignment - Dynamic ProgrammingMediumAuto-gradedCheck Palindrome Transformation Within K Removals
Determine if a given string can be converted into a palindrome by removing at most k characters.
Dynamic Programmingdynamic-programmingstringsbit-manipulation - Dynamic ProgrammingMediumAuto-gradedMaximum Independent Set on Line and Binary Tree
Find the maximum weight independent set for both a linear sequence and a binary tree network under non-adjacency constraints.
Dynamic Programmingdynamic-programmingtrees-graphsarrays - Dynamic ProgrammingMediumAuto-gradedCheapest Right-and-Down Route Across a Cost Map
Compute the minimum total cost of a route through a rectangular cost grid using only right and down moves, which tests 2D dynamic programming with a space optimization.
Dynamic Programmingdynamic-programminggridmatrixoptimization - Dynamic ProgrammingMediumAuto-gradedMinimum Containers for Target Volume
Find the minimum combination of reusable containers to reach an exact target total volume, or return None if impossible.
Dynamic Programmingdynamic-programmingunbounded-knapsackbacktracking - Dynamic ProgrammingHardAuto-gradedMaximum Non-Adjacent Node Value Sum in Binary Tree
Find the maximum total node sum from a binary tree represented as a level-order list such that no two selected nodes share a parent-child edge.
Dynamic Programmingtrees-graphsdynamic-programmingarrays - Dynamic ProgrammingMediumAuto-gradedCount Grid Walkways Without Three Consecutive Steps
Count valid grid paths composed of horizontal and vertical steps such that no direction is repeated three times in a row.
Dynamic Programmingdynamic-programminggridcombinatoricsmemoization - Dynamic ProgrammingMediumAuto-gradedDistinct Sub-Multisets That Hit a Target Sum
Enumerate every distinct selection of list elements, each used at most once, that sums to a target, with negatives, zeros and duplicates allowed. Tests backtracking over value counts.
Dynamic Programmingbacktrackingsubset-sumduplicatesenumeration - Dynamic ProgrammingMediumAuto-gradedHighest-Yield Consecutive Stretch in a Profit Log
Find the largest total achievable by a non-empty run of adjacent integers, handling all-negative inputs and large sums, in one pass with constant extra space.
Dynamic Programmingkadanesubarraydynamic-programmingarrays - Dynamic ProgrammingMediumAuto-gradedMaximum Disjoint Triples Summing to 15
Find the most disjoint three-card groups that each sum to 15, using memoized search over value counts because greedy choices can block better groupings.
Dynamic Programmingmemoizationrecursioncombinatoricsstate-compression - Dynamic ProgrammingHardAuto-gradedBest Profit from a Capped Number of Round-Trip Trades
Maximize profit from daily share prices using at most k non-overlapping buy-then-sell trades, testing state-based dynamic programming and handling a trade limit that never binds.
Dynamic Programmingdynamic-programmingarraysstock-tradingstate-machine - Dynamic ProgrammingMediumAuto-gradedMost Populous Digit-Sum Group in a Number Range
Count integers in a huge range grouped by digit sum and return the largest group size, which needs a digit DP with prefix-count subtraction rather than enumeration.
Dynamic Programmingdigit-dpcountingrange-queriesmath - Dynamic ProgrammingMediumAuto-gradedLongest Shared Run Between Two Integer Lists
Find the longest block of consecutive values common to two integer lists, and report its length and the smallest pair of start positions, using dynamic programming over suffix matches.
Dynamic Programmingdynamic-programmingarrayssubarraytie-breaking - Dynamic ProgrammingMediumAuto-gradedTallest Staircase Walk Across a Number Board
Find the longest chain of orthogonally adjacent cells with strictly increasing values in a 2D grid, testing DAG longest-path DP, memoization, and avoiding deep recursion.
Dynamic Programmingdynamic-programminggraphdfsmemoization - Dynamic ProgrammingHardAuto-gradedMinimum Disorder When Interleaving Two Job Queues
Interleave two letter strings while keeping each one's order, minimizing out-of-order pairs; tests 2D prefix DP with O(1) transition costs from alphabet-count tables.
Dynamic Programmingdynamic-programmingstringsprefix-countsinterleaving - Dynamic ProgrammingHardAuto-gradedFull-String Matching with Dot and Star Wildcards
Decide whether a whole text matches a pattern with '.' and '*' wildcards, using prefix-based dynamic programming over text and pattern positions.
Dynamic Programmingdynamic-programmingstringspattern-matchingrecursion - Dynamic ProgrammingMediumAuto-gradedMaximum Ore Haul on a Climb-and-Step Grid Route
Grid dynamic programming: find the route with the largest sum from the bottom-left to the top-right cell when only moving up or right.
Dynamic Programmingdynamic-programminggridmatrixpath-sum - Dynamic ProgrammingMediumAuto-gradedDistinct Value Groups Summing to a Goal, Each Item Used Once
Enumerate every distinct multiset of values from a list with repeats that adds up to a goal, using each position at most once, via sorted backtracking with duplicate skipping.
Dynamic Programmingbacktrackingrecursionsortingcombinations - Dynamic ProgrammingMediumAuto-gradedCounting Valid Ordered Binary Trees on n Labeled Nodes
Count the distinct binary search trees on keys 1..n by splitting on the root and combining independent subtree counts with dynamic programming.
Dynamic Programmingdynamic-programmingcombinatoricsbinary-search-treecatalan-numbers - Dynamic ProgrammingMediumAuto-gradedLongest Shared Block After Removing One Character
Find the longest block shared with a second string after optionally deleting one character from the first, using an O(n*m) DP with a deletion-used state.
Dynamic Programmingdynamic-programmingstringslongest-common-substring - Dynamic ProgrammingMediumAuto-gradedCheapest Right-Down Route Through a Cost Grid
Compute the minimum total cost of a route from the top-left to the bottom-right of a grid when only right and down moves are allowed, using dynamic programming.
Dynamic Programmingdynamic-programminggridmatrixoptimization - Dynamic ProgrammingMediumAuto-gradedBest Haul from a Row of Stalls Without Adjacent Picks
Pick values from a row so that no two chosen positions are neighbors, maximizing the total, which tests recognizing and implementing a simple one-dimensional dynamic programming recurrence.
Dynamic Programmingdynamic-programmingarraysnon-adjacent-selection - Dynamic ProgrammingMediumAuto-gradedFewest Coins to Form Target Sum
Tests dynamic programming with unbounded resources to compute the minimal coin count for a target value, handling impossible cases.
Dynamic Programmingdynamic-programmingcoin-changeoptimization