Practice Arena

Python Coding Challenges

Write real Python in the browser. Instant feedback. From beginner to expert.

467 challenges 330 easy 120 medium 17 hard
Dynamic Programming medium

Levenshtein Distance

Implement the classic Levenshtein distance algorithm to measure string similarity.

strings dynamic-programming edit-distance
+30 pts 30m
Dynamic Programming medium

Max Profit from Selling Twice

Compute the maximum profit that can be achieved by completing at most two buy-sell transactions on a given price array.

dynamic programming arrays stock
+28 pts 30m
Dynamic Programming medium

Bell number

Implement a function to compute the Bell number B(n) using dynamic programming.

dp combinatorics math
+25 pts 25m
Dynamic Programming easy

Min cost climbing stairs

Compute the minimum total cost to reach the top of a staircase, given you can climb 1 or 2 steps at a time.

dynamic programming memoization array
+10 pts 15m
Dynamic Programming easy

House Robber

Given a list of house values, return the maximum sum you can rob without robbing two adjacent houses.

dynamic-programming arrays optimization
+10 pts 15m
Dynamic Programming medium

House Robber Circular

Solve the House Robber problem with houses arranged in a circle.

dynamic-programming arrays circular
+25 pts 30m
Dynamic Programming easy

Unique Paths in a Grid

Count the number of unique paths from the top-left corner to the bottom-right corner of a grid, moving only right and down.

dynamic-programming grid counting
+15 pts 20m
Dynamic Programming medium

Unique Paths with Obstacles

Given a 2D grid with obstacles, count the unique paths from top-left to bottom-right moving only down or right.

dynamic-programming grid 2d-array
+25 pts 25m
Dynamic Programming easy

Triangle Minimum Path

Compute the minimum path sum from top to bottom of a triangle given as a list of lists.

dynamic-programming bottom-up arrays
+12 pts 20m
Dynamic Programming medium

Maximal square

Given a 2D binary matrix of 0s and 1s, compute the area of the largest square containing only 1s.

dynamic-programming matrix maximal-square
+30 pts 30m
Dynamic Programming medium

Longest Common Subsequence

Given two strings, compute the length of the longest subsequence common to both.

dynamic-programming strings lcs
+30 pts 30m
Dynamic Programming medium

Longest Palindromic Subsequence

Compute the length of the longest palindromic subsequence in a given string.

strings dp subsequence
+25 pts 30m
Dynamic Programming medium

Edit Distance (Levenshtein Distance)

Implement the classic edit distance algorithm to find the minimum number of single-character edits required to transform one string into another.

dynamic-programming strings levenshtein-distance
+25 pts 30m
Dynamic Programming medium

0/1 Knapsack

Implement the classic 0/1 Knapsack dynamic programming solution to maximize value under a weight capacity.

dynamic-programming knapsack optimization
+30 pts 25m
Dynamic Programming medium

Unbounded Knapsack

Given item weights and values with unlimited copies, find the maximum total value that fits in a knapsack capacity.

dynamic-programming knapsack optimization
+30 pts 25m
Dynamic Programming medium

Partition Equal Subset

Determine whether a given list of positive integers can be partitioned into two subsets with equal sum.

dynamic-programming subset-sum memoization
+30 pts 25m
Dynamic Programming medium

Coin Change Minimum

Given coin denominations and a target amount, compute the minimum number of coins needed or -1 if impossible.

dynamic-programming coins minimum
+30 pts 25m
Dynamic Programming medium

Coin Change Ways

Count the number of distinct combinations of coins that sum to a target amount.

dynamic programming coins counting
+30 pts 25m
Dynamic Programming medium

Perfect Squares Sum

Given a positive integer n, return the least number of perfect squares (e.g., 1, 4, 9, 16, ...) that sum to n.

dynamic-programming math optimization
+25 pts 25m
Dynamic Programming medium

Integer Break Product

Given a positive integer n, break it into at least two positive integers that sum to n and maximize their product.

integer-break dynamic-programming max-product
+25 pts 30m
Dynamic Programming medium

Word Break DP

Implement a function to check if a string can be segmented into space-separated dictionary words.

dynamic-programming strings word-break
+20 pts 25m
Dynamic Programming hard

Palindrome Partitioning Minimum Cuts

Given a string, return the minimum number of cuts needed such that every substring in the partition is a palindrome.

dynamic-programming palindrome strings
+40 pts 35m
Dynamic Programming hard

Egg Drop Puzzle

Given k eggs and n floors, compute the minimum number of attempts required in the worst case to find the highest safe floor.

dynamic-programming optimization classic-puzzle
+45 pts 35m
Dynamic Programming medium

Paint House Colors

Given a cost matrix, compute the minimum total cost to paint all houses with no two adjacent houses having the same color.

dynamic-programming optimization arrays
+20 pts 25m
Dynamic Programming medium

Buy Sell Stock with Cooldown (DP)

Given daily stock prices, compute the maximum profit you can achieve if you must wait one day after selling before buying again.

dynamic-programming state-machine stocks
+25 pts 25m

Showing 25 challenges · Dynamic Programming

Dynamic Programming — Python coding challenges

What you will find here

This page lists dynamic programming challenges — real Python problems you solve in the browser IDE with instant test feedback. Each challenge includes a clear brief, starter code, and automated checks.

Challenges vs tutorials and quizzes

Challenges test what you can build under constraints. For guided teaching, use our Python tutorials. For quick checks, try quizzes or copy snippets from code samples.