Practice
Short problems tied directly to the visualizations. Each one comes with layered hints, a written approach, complexity analysis, follow-up questions, and a link that opens the matching algorithm with the example input already loaded.
10
problems
Pair with target sum
beginnerGiven a sorted array of integers and a target, return the indices of the two numbers that add up to the target. Exactly one solution exists and you may not use the same element twice.
Contains duplicate
beginnerGiven an array of integers, return true if any value appears at least twice, otherwise false. Explain the cost of your approach before you optimise it.
Search insert position
beginnerGiven a sorted array of distinct integers and a target, return the index where the target is found. If it is absent, return the index where it would be inserted to keep the array sorted.
Reverse a linked list
intermediateGiven the head of a singly linked list, reverse the list so the last node becomes the head. Do it in place, using O(1) extra memory.
Valid parentheses
intermediateGiven a string containing only ( ) [ ] { }, determine whether it is valid: every opening bracket must be closed by the same type in the correct order.
Validate a binary search tree
intermediateGiven a binary tree, return true if it satisfies the BST ordering rule: every node's left subtree contains only smaller values and every right subtree only larger values.
Shortest path in an unweighted graph
intermediateGiven an undirected graph and two nodes, find the length of the shortest path between them. Every edge costs 1.
Detect a cycle in a directed graph
advancedGiven a directed graph, return true if it contains a cycle — a path that follows directed edges back to a node it already visited.
Course schedule (topological order)
advancedYou must take numCourses courses with prerequisites given as pairs (a, b) meaning 'b before a'. Return true if you can finish every course.
Climbing stairs with a cost
advancedYou are climbing a staircase of n steps. Each step has a cost. You may climb 1 or 2 steps at a time. Return the minimum total cost to reach the top.
Track your progress
Problems you mark as solved and visualizations you finish are saved locally.
Progress lives in this browser only — nothing is uploaded.