~/problems
Problems
Basics first, then the classics, then company-style assessments. Every problem has tests you run right here; multi-level ones unlock as you go. See the roadmap.
First Quest
The gentle way in: warm-ups, short story problems and the famous first classics across 14 interview topics, from hash maps to bit tricks.
0 of 45 solved · about 10 hours in all
45 problems
Interview roadmap
Arrays & hashing Counting, lookups, sorting with keys, prefix sums.
Hash maps and counting guide
- Count with a dict, then look up basics py · c++ · java easy
- Coffee-shop loyalty stamps py · c++ · java easy
- Valid Anagram py · c++ · java easy
- Two Sum ▶ boss game py · c++ · java easy
Two pointers Scan from both ends, or fast and slow.
- Reverse a list in place basics py · c++ · java easy
- Match photos to GPS readings py · c++ · java easy
- Valid Palindrome py · c++ · java easy
Stacks Matching brackets, paths, next greater element.
Stacks guide
- An undo log with a stack basics py · c++ · java easy
- Valid Parentheses ▶ boss game py · c++ · java easy
Sliding window Grow and shrink a window over a string or array.
- Best sum of k in a row basics py · c++ · java easy
- Repeat artists in every k-song stretch py · c++ · java easy
- Best Time to Buy and Sell Stock ▶ boss game py · c++ · java easy
Binary search Sorted lookups, rotations, searching the answer.
Binary search guide
- Guess the number basics py · c++ · java easy
- Log entries in a time range py · c++ · java easy
- Binary Search ▶ boss game py · c++ · java easy
Linked lists Reverse, merge, detect cycles, build an LRU cache.
Linked lists guide
- Middle node with fast and slow pointers basics py · c++ · java easy
- Shunt the extra wagons onto a siding py · c++ · java easy
- Reverse Linked List ▶ boss game py · c++ · java easy
- Merge Two Sorted Lists py · c++ · java easy
Trees Traversals, BSTs, and answers built bottom-up.
Binary trees guide
- Preorder, inorder and postorder basics py · c++ · java easy
- Orchard: branches that need a prop py · c++ · java easy
- Search in a Binary Search Tree ▶ boss game py · c++ · java easy
- Maximum Depth of Binary Tree ▶ boss game py · c++ · java easy
- Invert Binary Tree ▶ boss game py · c++ · java easy
Heaps Top-k, merging streams, scheduling by time.
Heaps and priority queues guide
- The k smallest values with heapq basics py · c++ · java easy
- Help desk by urgency py · c++ · java easy
- Last Stone Weight ▶ boss game py · c++ · java easy
Backtracking Recursion that tries, undoes and tries again.
- All strings of 0s and 1s basics py · c++ · java easy
- Seating plan without feuding neighbours py · c++ · java easy
- Tower of Hanoi ▶ boss game 2 levels py · c++ · java easy
Intervals Merge, insert and sweep over ranges.
- Do any meetings overlap? basics py · c++ · java easy
- Longest stretch with the shop open py · c++ · java easy
- Merge Intervals ▶ boss game Roblox py · c++ · java medium
Graphs Grids and networks: BFS, DFS, cycles, ordering.
BFS / multi-source BFS guide
- Shortest hop counts from one node basics py · c++ · java easy
- Museum: fewest doors to an exhibit ▶ boss game py · c++ · java easy
DFS and connected components guide
- Everything reachable from a node basics py · c++ · java easy
- Number of Islands ▶ boss game py · c++ · java medium
1-D dynamic programming One index of state: stairs, robbers, subsequences.
Intro DP guide
- Cheapest way up a staircase basics py · c++ · java easy
- Flower cart: station or park py · c++ · java easy
- Climbing Stairs ▶ boss game py · c++ · java easy
- House Robber ▶ boss game py · c++ · java medium
- Maximum Subarray ▶ boss game py · c++ · java medium
Bit manipulation Masks, shifts and IP-address arithmetic.
- IPv4 addresses as 32-bit integers basics py · c++ · java easy
- Watering rota as weekday bitmasks py · c++ · java easy
- Power of Two ▶ boss game 2 levels py · c++ · java easy