Push your limits with hand-crafted algorithmic challenges. Solve problems across Trees, Graphs, Dynamic Programming, and more — with interactive code editors and real test cases.
Solve the problem within 30 minutes to earn points and rank up.
Solve this challenging problem within 30 minutes to earn even more points!
Solve this challenging problem within 60 minutes to earn even more points!
Return all three traversals of a binary tree. Great entry point into recursive tree thinking.
Find the length of the longest root-to-leaf path using elegant recursion.
Count all nodes with no children — a clean exercise in base-case thinking.
Compute the sum of every node value in the binary tree recursively.
Traverse a binary tree level by level using BFS — a classic queue-based challenge.
Find the deepest node that is a common ancestor of two given nodes.
Verify that a binary tree satisfies all BST properties using bounds propagation.
Find the longest path (in edges) between any two nodes in the tree.
Return the first and last visible node at every level of the tree.
Design an encode/decode scheme so any tree can be stored and fully reconstructed.
Group tree nodes by column position, breaking ties by row then value.
Rebuild a unique binary tree given its preorder and inorder traversals.
Find the highest-sum path between any two nodes — negative values make it tricky.
Two BST nodes were swapped by mistake. Restore the tree in O(n) time.
Calculate the n-th Fibonacci number using dynamic programming — the classic introduction to memoization and tabulation.
Count the distinct ways to climb n stairs taking 1 or 2 steps at a time — identical recurrence to Fibonacci.
Find the minimum cost to reach the top of a staircase given a cost array — classic DP optimization.
Maximize loot from non-adjacent houses — a foundational DP problem with a beautiful two-variable space optimization.
Find the fewest coins to reach a target amount — introducing unbounded knapsack DP.
Find the length of the longest strictly increasing subsequence — a cornerstone of sequence DP.
Return the length of the longest common subsequence of two strings — the canonical 2D DP problem.
Pack a knapsack to maximize value without exceeding capacity — the quintessential DP on items.
Determine if an array can be split into two subsets with equal sum — a knapsack variant with a twist.
Count the number of ways to decode a digit string to letters — blending DP with string parsing.
Count distinct paths from top-left to bottom-right of a grid — the quintessential 2D DP grid problem.
Find the minimum edit operations (insert, delete, replace) to convert one string to another — classic interval DP.
Count the number of combinations that sum to a target amount — unbounded knapsack counting variant.
Find the optimal parenthesization of matrix products to minimize scalar multiplications — interval DP at its finest.
Find the longest subsequence of a string that is a palindrome — interval DP on a single string.
Maximize coins by strategically bursting balloons — a tricky interval DP problem of choosing the last element.
Maximize revenue by cutting a rod into pieces of varying lengths — unbounded knapsack meets optimization.
Find the minimum number of trials to identify the critical floor — a deceptively hard DP problem with a clever reformulation.
Rob houses arranged as a binary tree without triggering alarms — applying DP to tree structures with post-order DFS.
Solve the Travelling Salesman Problem using bitmask DP — representing visited city sets as integers for exponential state compression.
Merge two sorted arrays into one sorted array in-place.
Find the kth largest element without fully sorting the array.
Merge multiple sorted chunks simulating external disk sorting.
Merge multiple sorted linked lists (simulated as arrays).
Sort a string based on the frequency of its characters.
Find the median of two sorted arrays in logarithmic time.