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 31–60 of 137 results
- Dynamic ProgrammingEasyAuto-gradedBankrupt Risk in Dice Game
Compute the exact probability of wealth hitting zero or below at any step during a finite sequence of random dice rolls.
Dynamic Programmingdynamic-programmingmath-bitsstatistics - Dynamic ProgrammingMediumAuto-gradedCheapest Daily Ticket Plan Without Back-to-Back Repeats
Choose one of three item types each day with no type repeated on adjacent days, minimizing total cost and returning the unique optimal sequence of choices.
Dynamic Programmingdynamic-programmingpath-reconstructionpaint-house - 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 ProgrammingMediumModel answer0/1 to Bounded Knapsack Optimization and Traceback
Solve the 0/1 knapsack problem with optimal item selection, optimize its space complexity, and extend the solution to bounded knapsacks efficiently.
Dynamic Programmingdynamic-programmingarrayssliding-windowknapsack - 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 ProgrammingMediumModel answerCheapest Fence Painting With No Matching Neighbors
Color a row of posts from a cost table so no two neighbors match, minimizing total cost, using memoized recursion and a space-optimized bottom-up DP, and recover one optimal coloring.
Dynamic Programmingdynamic-programmingmemoizationspace-optimizationreconstruction - 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 ProgrammingHardModel answerIdentify Compound Words in a Dictionary
Find all strings in a list that can be constructed by concatenating two or more smaller strings from the same list.
Dynamic Programmingstringsdynamic-programmingtriehash-table - 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 ProgrammingMediumModel answerLeft-to-Right Plus/Times Expression from a Subsequence
Decide whether a subsequence of positive integers, joined by + and * and evaluated strictly left to right, can equal a target, and produce one valid expression.
Dynamic Programmingdynamic-programmingbacktrackingpruningreverse-search - 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 ProgrammingHardModel answerBest Self-Matching Count After Removing Array Elements
Delete any elements from an array so the most remaining values equal their new 1-based position. Reduce it to a longest-chain problem solved in O(n log n).
Dynamic Programmingdynamic-programminglongest-increasing-subsequencebinary-searchsubsequence - Dynamic ProgrammingMediumModel answerAutonomous Drone Navigation in Dynamic Canyons
Design a deterministic per-tick controller for a thruster-driven drone navigating procedurally generated obstacle canyons using lookahead simulation.
Dynamic Programmingdynamic-programminglookahead-searchsimulationmemoization - 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