~/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.
Study plans
45
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.
75
Bossfight 75
The main interview topics, our way: our own story problems and boss fights first, then the classics you're most likely to be asked, up to the famous hard ones.
150
Bossfight 150
Bossfight 75 plus the rest of the interview roadmap, our practical-systems and concurrency originals, the next tier of classics and more of the hard ones.
650 problems · advanced & competitive are listed separately
Interview roadmap
Arrays & hashing Counting, lookups, sorting with keys, prefix sums.
Complexity analysis guide
- Play first: The Big O Showdown 1-minute game Big O: n² vs n log n
- Fast membership with a set basics py · c++ · java easy
- Count distinct values code the boss py · c++ · java easy
- Cross-team handshake energy py · c++ · java easy
Python toolkit
- Most common words with Counter basics easy
- Index words by line with defaultdict easy
- Newest first, then by user easy
Hash maps and counting guide
- Play first: The Monster Vault 1-minute game Hash map (buckets and chaining)
- Count with a dict, then look up basics py · c++ · java easy
- Coffee-shop loyalty stamps py · c++ · java easy
- Design HashMap code the boss py · c++ · java easy
Sorting, custom keys, coordinate compression guide
- Play first: The Tally 1-minute game Counting sort
- Leaderboard with a tuple sort key basics py · c++ · java easy
- Natural order for scanned photos py · c++ · java easy
- Counting Sort code the boss 2 levels py · c++ · java easy
Prefix sums and difference arrays guide
- Play first: The Gold Towers 1-minute game Prefix sums
- Range sums with a prefix array code the boss basics py · c++ · java easy
- Uphill metres between checkpoints py · c++ · java easy
- Range Sum Query 2D Immutable py · c++ · java medium
Two pointers Scan from both ends, or fast and slow.
- Play first: Two Knights, One Bridge 1-minute game Two pointers
- Reverse a list in place basics py · c++ · java easy
- Match photos to GPS readings py · c++ · java easy
- Remove Duplicates from Sorted Array py · c++ · java easy
Stacks Matching brackets, paths, next greater element.
Stacks guide
- Play first: The Seal 1-minute game Stack (bracket matching)
- An undo log with a stack basics py · c++ · java easy
- Valid Parentheses code the boss py · c++ · java easy
- Implement Queue Using Stacks py · c++ · java easy
Monotonic stack guide
- Play first: The Tower Brawl 1-minute game Next greater element (monotonic stack)
- Nearest smaller value to the left basics py · c++ · java easy
- Messages between signal towers py · c++ · java easy
- Next Greater Element I code the boss py · c++ · java easy
Stack: path parsing guide
- Play first: The Mole King 1-minute game Stack (simplify a path)
- Current folder after each move basics py · c++ · java easy
- Where each piece of text lives py · c++ · java easy
- Simplify Path code the boss py · c++ · java medium
Math & matrices Digit arithmetic, rotating and marking grids in place.
- Play first: The Crooked Portrait 1-minute game Rotate a grid in place
- Walk the outer ring of a grid basics py · c++ · java easy
- Plus One py · c++ · java easy
- Happy Number py · c++ · java easy
Sliding window Grow and shrink a window over a string or array.
- Play first: The Dragon Market 1-minute game One-pass max profit
- 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 code the boss py · c++ · java easy
Binary search Sorted lookups, rotations, searching the answer.
Binary search guide
- Play first: The Sorted Golem 1-minute game Binary search
- Guess the number basics py · c++ · java easy
- Log entries in a time range py · c++ · java easy
- Binary Search code the boss py · c++ · java easy
Binary search on the answer guide
- Play first: The Hungry Boss 1-minute game Binary search on the answer
- Smallest value that passes a check basics py · c++ · java easy
- Biggest square cookies py · c++ · java medium
- Sqrt(x) py · c++ · java easy
Prefix sums + binary search guide
- Play first: The Loot Goblin 1-minute game Prefix sums + binary search
- Which bucket holds position x basics py · c++ · java easy
- How far does the ticket money go? py · c++ · java easy
- How many items fit the budget Uber py · c++ · java easy
Sorted containers (bisect) guide
- Play first: The Server Ring 1-minute game Consistent hashing
- Floor and ceiling with bisect basics py · c++ · java easy
- Nearest free parking spot py · c++ · java easy
- Consistent Hashing code the boss py · c++ · java medium
Linked lists Reverse, merge, detect cycles, build an LRU cache.
Linked lists guide
- Play first: The Chain 1-minute game Reversing a linked list
- 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 code the boss py · c++ · java easy
LRU / LFU cache guide
- Play first: The Full Inventory 1-minute game LRU cache (least recently used)
- A recency list basics py · c++ · java easy
- Recent files menu py · c++ · java easy
- LRU Cache code the boss py · c++ · java medium
Trees Traversals, BSTs, and answers built bottom-up.
Binary trees guide
- Play first: The Door Maze 1-minute game Binary search tree lookup
- 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 code the boss py · c++ · java easy
Tree DP guide
- Play first: The Night Owl 1-minute game Tree DP (rob or skip)
- Height of a tree basics py · c++ · java easy
- Pruning a diseased fruit tree py · c++ · java easy
- Count subordinates in a company tree py · c++ · java easy
Tries Prefix trees for words and autocomplete.
- Play first: The Spell Book 1-minute game Trie (prefix tree)
- Count words by prefix with a trie basics py · c++ · java easy
- Abbreviated shell commands py · c++ · java easy
- Substring Wrapper MetaUber py · c++ · java easy
Heaps Top-k, merging streams, scheduling by time.
Heaps and priority queues guide
- Play first: The Boss Queue 1-minute game Heap (priority queue)
- The k smallest values with heapq basics py · c++ · java easy
- Help desk by urgency py · c++ · java easy
- Kth Largest Element in a Stream py · c++ · java easy
Heap scheduling (deadlines, leases) guide
- Play first: The Lone Smith 1-minute game Shortest job first (min-heap)
- Hand each job to the earliest-free server basics py · c++ · java easy
- Laundromat with impatient customers py · c++ · java easy
- Task Scheduler py · c++ · java medium
Backtracking Recursion that tries, undoes and tries again.
- Play first: The Doom Tower 1-minute game Recursion
- All strings of 0s and 1s basics py · c++ · java easy
- Seating plan without feuding neighbours py · c++ · java easy
- Tower of Hanoi code the boss 2 levels py · c++ · java easy
Intervals Merge, insert and sweep over ranges.
- Play first: The Waves 1-minute game Merge intervals
- Do any meetings overlap? basics py · c++ · java easy
- Longest stretch with the shop open py · c++ · java easy
- Merge Intervals code the boss Roblox py · c++ · java medium
Greedy Sort, then take the locally best choice.
- Play first: The River Crossing 1-minute game Greedy (farthest reach)
- Feed the most children basics py · c++ · java easy
- Fewest benches along the trail py · c++ · java easy
- Lemonade Change py · c++ · java easy
Graphs Grids and networks: BFS, DFS, cycles, ordering.
BFS / multi-source BFS guide
- Play first: The Maze 1-minute game Breadth-first search
- Shortest hop counts from one node basics py · c++ · java easy
- Museum: fewest doors to an exhibit code the boss py · c++ · java easy
- Shortest Path in Binary Matrix py · c++ · java medium
DFS and connected components guide
- Play first: The Burning Isles 1-minute game Flood fill (DFS or BFS on a grid)
- Everything reachable from a node basics py · c++ · java easy
- Storm outage: neighbourhoods without a generator py · c++ · java easy
- Island Perimeter py · c++ · java easy
Cycle detection guide
- Play first: The Haunted Halls 1-minute game Cycle detection (three colours)
- Does a directed graph have a cycle? basics py · c++ · java easy
- Spreadsheet: show the circular reference py · c++ · java medium
- Find Eventual Safe States code the boss py · c++ · java medium
Bipartite graphs / 2-colouring guide
- Play first: The Clan War 1-minute game Bipartite check (two-coloring with BFS)
- Colour by BFS depth, find the bad edges basics py · c++ · java easy
- Most edges you can add to a tree and stay bipartite py · c++ · java easy
- Is Graph Bipartite? code the boss py · c++ · java medium
Topological sort (Kahn's) guide
- Play first: The Quest Board 1-minute game Topological sort (Kahn's algorithm)
- Check a topological order basics py · c++ · java easy
- Course Schedule py · c++ · java medium
- Course Schedule II code the boss py · c++ · java medium
1-D dynamic programming One index of state: stairs, robbers, subsequences.
Intro DP guide
- Play first: The Hydra 1-minute game Memoization
- Cheapest way up a staircase basics py · c++ · java easy
- Flower cart: station or park py · c++ · java easy
- Climbing Stairs code the boss py · c++ · java easy
Longest increasing subsequence guide
- Play first: The Rising Chain 1-minute game Patience sorting (LIS)
- LIS length ending at each index (O(n²) DP) basics py · c++ · java easy
- Choir line with a height gap py · c++ · java medium
- Reconstruct a longest increasing subsequence py · c++ · java medium
Weighted graphs Dijkstra, union-find, spanning trees.
Dijkstra (weighted shortest paths) guide
- Play first: The Dragon's Cave 1-minute game Dijkstra's algorithm (shortest paths with a heap)
- The order Dijkstra settles nodes basics py · c++ · java easy
- Walk to the nearest open pharmacy py · c++ · java medium
- Network Delay Time code the boss py · c++ · java medium
Union-Find guide
- Play first: The Eight Kingdoms 1-minute game Union-find
- Find the root of every node basics py · c++ · java easy
- Pooled lunch money py · c++ · java easy
- Union-Find class with component count py · c++ · java easy
Minimum spanning tree guide
- Play first: The Road Builder 1-minute game Kruskal's algorithm (minimum spanning tree)
- Cheapest edge out of a group basics py · c++ · java easy
- Cheapest repairs to reconnect every city py · c++ · java medium
- Finish the irrigation network code the boss py · c++ · java medium
2-D dynamic programming Grids, two strings, knapsacks, ranges.
Grid DP guide
- Play first: The Castle Road 1-minute game Grid dynamic programming
- Can you reach the corner? basics py · c++ · java easy
- Unique Paths code the boss 2 levels py · c++ · java medium
- Minimum Path Sum py · c++ · java medium
String DP (edit distance, LCS) guide
- Play first: The Word Duel 1-minute game Edit distance (dynamic programming)
- Longest common substring basics py · c++ · java easy
- Threading beads from two belts py · c++ · java medium
- Edit Distance code the boss py · c++ · java medium
Knapsack and coin change guide
- Play first: The Loot Limit 1-minute game 0/1 knapsack (dynamic programming)
- Can a subset hit the target? basics py · c++ · java easy
- Most pages within a budget code the boss py · c++ · java medium
- Prize stall with limited stock py · c++ · java medium
Interval (range) DP guide
- Play first: The Echo Bat 1-minute game Interval DP
- Cheapest way to merge adjacent piles basics py · c++ · java easy
- Longest Palindromic Subsequence code the boss py · c++ · java medium
- Least wobbly hanging mobile py · c++ · java medium
Bit manipulation Masks, shifts and IP-address arithmetic.
- Play first: The Bit Check 1-minute game Bit trick: n & (n − 1)
- IPv4 addresses as 32-bit integers basics py · c++ · java easy
- Watering rota as weekday bitmasks py · c++ · java easy
- Power of Two code the boss 2 levels py · c++ · java easy
Practical systems
Simulation & OOP design Model the rules precisely, keep it extensible.
Simulation guide
- Play first: The Spiral Vault 1-minute game Spiral order (four walls)
- Robot on a walled grid basics py · c++ · java easy
- Rain barrel log py · c++ · java easy
- Pick the elevator that answers a call Pinterest py · c++ · java easy
Object-oriented design and extensible simulations guide
- A bank account class with invariants basics py · c++ · java easy
- Greenhouse watering rota py · c++ · java easy
- Note-taking system with timestamps and search assessment 2 levels py · c++ · java easy
Stateful stores Key-value stores, file systems, banks, with history.
Time-travel key-value store guide
- The value as of time t basics py · c++ · java easy
- Library display shelves over time py · c++ · java easy
- Time-Based Key-Value Store Citadel py · c++ · java medium
In-memory file system guide
- Directory tree from paths basics py · c++ · java easy
- Camera card: find by extension, delete folders py · c++ · java easy
- Design In-Memory File System py · c++ · java medium
In-memory database guide
- Records of fields in nested dicts basics py · c++ · java easy
- Per-field undo in a record store py · c++ · java easy
- Key-value store with nested transactions and rollback assessment 2 levels py · c++ · java medium
Bank system guide
- Accounts with validated deposits and withdrawals basics py · c++ · java easy
- Settle a night's tab all-or-nothing py · c++ · java easy
- Bank system assessment 4 levels Anthropic py · c++ · java medium
Iterators & parsers Lazy sequences, tokenizers and tiny interpreters.
Iterators and generators guide
- An iterator class that yields chunks basics py · c++ · java easy
- Collapse repeated sensor readings py · c++ · java easy
- Iterator with Filter Coinbase py · c++ · java easy
Parsers and interpreters guide
- Tokenize an arithmetic expression basics py · c++ · java easy
- Parse a label printer's key=value line py · c++ · java easy
- URL Query Parameter Parsing Airbnb py · c++ · java easy
Streams & durability Rate counters, serialization, retrying work queues.
Rolling windows and rate counters guide
- Play first: The Gatekeeper 1-minute game Token bucket rate limiter
- Events in the last N seconds basics py · c++ · java easy
- Café drink counts over the last N seconds py · c++ · java easy
- Logger Rate Limiter py · c++ · java easy
Serialization and durability guide
- Length-prefixed encoding of a list of strings basics py · c++ · java easy
- Escaped key=value settings file py · c++ · java easy
- Encode and decode with RLE and bit-packing Databricks py · c++ · java medium
Fault-tolerant work queue guide
- Expire leases with a min-heap basics py · c++ · java easy
- Round-robin print queue across customers py · c++ · java easy
- Fault-tolerant work queue assessment 3 levels OpenAI py · c++ · java medium
Files & networks Deduplicating files, resolving names.
File deduplication guide
- Group paths by identical content basics py · c++ · java easy
- Clean up notes synced from two laptops py · c++ · java easy
- Find duplicate files (size, prefix, content) assessment 3 levels Anthropic py · c++ · java medium
DNS resolver guide
- Follow a CNAME chain with loop detection basics py · c++ · java easy
- Exact and wildcard records, most specific wins py · c++ · java easy
- DNS resolution with CNAME cycles assessment 5 levels Anthropic py · c++ · java hard
AI infrastructure Batchers, streaming parsers, prompt caches, sampling and token limits.
- Play first: The Napkin 1-minute game Back-of-the-envelope estimates
- Napkin math code the boss 3 levels py · c++ · java easy
- Streaming response parser assessment 4 levels py · c++ · java medium
- Dynamic request batcher assessment 4 levels py · c++ · java medium
Concurrency
Locks Mutexes, lock ordering, readers and writers.
Lock (mutex) guide
- Thread-safe counter basics py · c++ · java easy
- Last croissants at the bakery py · c++ · java easy
- Print in order with locks py · c++ · java easy
Deadlock and lock ordering guide
- Take several locks without deadlock basics py · c++ · java easy
- Shared party playlist py · c++ · java easy
- Deadlock-free bank transfers py · c++ · java easy
Reader-writer and modal locks guide
- A simple reader-writer lock basics py · c++ · java easy
- Timetable board: writers go first py · c++ · java easy
- ModalLock and FairModalLock assessment 3 levels OpenAI py · c++ · java hard
Coordination Semaphores, conditions and barriers.
Semaphore guide
- At most k at once basics py · c++ · java easy
- Laundromat washers py · c++ · java easy
- Bounded blocking queue py · c++ · java medium
Condition variable guide
- Countdown latch basics py · c++ · java easy
- Baggage carousel py · c++ · java easy
- FizzBuzz across four threads py · c++ · java medium
Barrier guide
- Build a reusable barrier basics py · c++ · java easy
- Street lamps that copy their neighbours py · c++ · java easy
Pools & pipelines Thread pools, crawlers, producer/consumer buffers.
Thread pool / concurrent crawler guide
- Parallel map with a pool basics py · c++ · java easy
- Fastest weather station wins py · c++ · java easy
- Multithreaded array sort assessment 2 levels py · c++ · java medium
Ring buffers and producer/consumer pipelines guide
- Blocking ring buffer basics py · c++ · java easy
- Greenhouse thermometer log py · c++ · java easy
- Queue three ways: ring buffer, growable array, linked list assessment 3 levels Optiver py · c++ · java medium
Async Many waiting tasks on one thread: limits, timeouts, retries.
- Async fetcher with limits assessment 4 levels medium