Skip to content
Tutorials Center
My learning

Topics

Lesson 225 of 225 ยท Practice and Review

The Top 100 Interview Problems, Mapped by Topic

A topic-by-topic map of 100 must-know coding interview problems, each with the technique that solves it and the lesson that teaches it. Includes a Python practice planner.

Interview preparation fails in one of two ways. Some people grind hundreds of random problems and never see the pattern behind them. Others read about every data structure and never practice. A map helps with both: it groups the classic problems by the technique that cracks them, so each practice session trains a pattern instead of a title.

Below are 100 well-known problems in 11 families. For each one you get the core idea in a few words, and each table points to the lesson on this site that teaches the technique. Solve a problem on your own first, then read the lesson to compare. The companion pages Patterns Cheat Sheet, Interview Questions and Coding Interview Plan tell you how to study and what to say in the room.

How to use this map

  1. Pick a family. Read its lesson link first if the technique is new.
  2. Solve three problems from the table without help. Time yourself.
  3. Write down the signal that told you which technique to use (a sorted array, a "subarray" in the statement, an "at most k" constraint).
  4. Return to the family a week later and redo the problems you missed.

1. Arrays and hashing

Lessons: Arrays, Hashing Patterns, Prefix Sums.

# Problem Core idea
1 Two sum one pass with a value-to-index dict
2 Contains duplicate set membership
3 Group anagrams sorted letters or letter counts as key
4 Longest consecutive sequence set, start only at sequence starts
5 Subarray sum equals k prefix sums with a counter
6 Product of array except self prefix and suffix products
7 Top k frequent elements counter plus heap or bucket sort
8 Majority element Boyer-Moore voting
9 First missing positive use the array itself as a hash
10 Rotate array three reversals

2. Two pointers and sliding window

Lessons: Two Pointers, Sliding Window, Kadane and Subarrays.

# Problem Core idea
11 Valid palindrome pointers from both ends
12 Three sum sort, then two pointers inside a loop
13 Container with most water move the shorter side
14 Trapping rain water two pointers with running maxima
15 Best time to buy and sell stock track the minimum so far
16 Longest substring without repeats window plus last-seen map
17 Minimum window substring expand, then shrink while valid
18 Maximum subarray Kadane's algorithm
19 Longest repeating character replacement window where size - max_count <= k
20 Sliding window maximum monotonic deque

3. Stacks and monotonic structures

Lessons: Stacks, Stack Applications, Monotonic Stack.

# Problem Core idea
21 Valid parentheses push openers, match closers
22 Min stack second stack of minima
23 Evaluate reverse Polish notation operand stack
24 Daily temperatures monotonic decreasing stack
25 Next greater element monotonic stack, process right to left
26 Largest rectangle in a histogram stack of increasing heights
27 Car fleet sort by position, compare arrival times
28 Decode string stack of (count, text)
29 Basic calculator stack with sign handling
30 Remove k digits greedy with a monotonic stack

Lessons: Binary Search, Binary Search Variants, Binary Search on the Answer.

# Problem Core idea
31 Search in a rotated array decide which half is sorted
32 Find the minimum in a rotated array compare mid with the right end
33 First and last position of a value lower and upper bound
34 Search a 2D matrix treat as one sorted list
35 Koko eating bananas binary search on the speed
36 Split array largest sum binary search on the answer plus greedy check
37 Median of two sorted arrays binary search the partition
38 Square root of x integer binary search
39 Find peak element move toward the larger neighbor
40 Time-based key-value store binary search over timestamps

5. Linked lists

Lessons: Linked List Problems, Linked List Techniques, Cycle Detection.

# Problem Core idea
41 Reverse a linked list three pointers
42 Merge two sorted lists dummy head
43 Detect and locate a cycle Floyd's tortoise and hare
44 Middle of a list slow and fast pointers
45 Remove the n-th node from the end gap of n between two pointers
46 Reorder list split, reverse, interleave
47 Add two numbers as lists carry while walking both lists
48 Copy list with random pointer map old nodes to new nodes
49 Merge k sorted lists min-heap of heads
50 LRU cache hash map plus doubly linked list

6. Trees

Lessons: Tree Traversals, Tree Problems, Binary Search Trees.

# Problem Core idea
51 Maximum depth recursion
52 Invert a binary tree swap children recursively
53 Same tree, subtree of another tree structural recursion
54 Level-order traversal BFS with a queue
55 Validate a BST pass min and max bounds
56 Lowest common ancestor split point of the two paths
57 Diameter of a tree height recursion tracking best path
58 Kth smallest in a BST inorder traversal
59 Serialize and deserialize a tree preorder with null markers
60 Binary tree maximum path sum return the best downward path

7. Heaps and tries

Lessons: Heaps, Top-K Problems, Tries.

# Problem Core idea
61 Kth largest element min-heap of size k or quickselect
62 K closest points to the origin heap by distance
63 Task scheduler max-heap or count formula
64 Find median from a data stream two heaps
65 Reorganize string max-heap, never place the same letter twice
66 Implement a trie nested dicts with an end marker
67 Word search II trie plus DFS on a grid
68 Design add and search words trie with wildcard DFS

8. Graphs

Lessons: Graph BFS, Graph DFS, Topological Sort, Union-Find.

# Problem Core idea
69 Number of islands DFS or BFS flood fill
70 Clone a graph DFS with an old-to-new map
71 Course schedule topological sort, cycle detection
72 Rotting oranges multi-source BFS
73 Word ladder BFS over one-letter changes
74 Pacific Atlantic water flow reverse flood fill from both oceans
75 Number of connected components union-find
76 Redundant connection union-find, the edge that closes a cycle
77 Network delay time Dijkstra
78 Cheapest flights within k stops Bellman-Ford with k rounds

9. Dynamic programming

Lessons: DP Intro, 1D DP, Grid DP, Knapsack, LIS, LCS and Edit Distance, Coin Change.

# Problem Core idea
79 Climbing stairs Fibonacci recurrence
80 House robber take or skip
81 Coin change unbounded knapsack
82 Longest increasing subsequence O(n log n) with patience tails
83 Longest common subsequence 2D table
84 Edit distance insert, delete, replace
85 Partition equal subset sum 0/1 knapsack on half the total
86 Unique paths grid DP
87 Word break prefix DP with a set
88 Decode ways one or two digits back

10. Greedy, intervals and backtracking

Lessons: Greedy Problems, Interval Scheduling, Backtracking, Subsets, Permutations and Combinations, N-Queens.

# Problem Core idea
89 Jump game track the farthest reachable index
90 Merge intervals sort by start, extend the last
91 Non-overlapping intervals sort by end, keep the earliest finisher
92 Meeting rooms II sweep line or min-heap of end times
93 Subsets include or exclude
94 Permutations swap or used-array recursion
95 Combination sum reuse allowed, prune when the sum exceeds the target
96 N-Queens row by row with column and diagonal sets
97 Gas station one pass, reset the start when the tank goes negative

11. Bits, math and design

Lessons: Bit Manipulation, Number Theory, Design Data Structures.

# Problem Core idea
98 Single number XOR everything
99 Number of 1 bits n & (n - 1)
100 Pow(x, n) fast exponentiation

Practice planner

A map is only useful if you track it. This short program keeps a topic-to-problem table, records which problems you solved, and suggests what to practice next: the family with the lowest completion rate first.

Python A tiny practice planner

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Reading a statement for the technique

The words in a problem statement give the technique away more often than not. This lookup table mirrors what experienced candidates do silently.

Python Keyword to technique hints

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Common mistakes

  • Memorizing solutions. Learn the signal that picks the technique; titles change, signals do not.
  • Skipping the brute force. State it first, give its cost, then optimize. Interviewers want to hear the reasoning.
  • Ignoring edge cases. Empty input, a single element, duplicates, negative numbers.
  • Not revisiting misses. Repetition after a delay is what makes patterns stick.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. A problem asks for the longest subarray satisfying some 'at most k' condition on positive numbers. Which technique is the first guess?

    'At most k' on a contiguous range with positive values is monotone: growing the window can only worsen the condition, so two pointers work.
  2. 2. You must find the minimum capacity of a ship so that all packages are delivered in D days. What pattern is this?

    The answer lies in a numeric range and feasibility is monotone in the capacity, so binary search on the answer fits.
  3. 3. Which technique solves 'number of islands'?

    Each island is a connected region of land cells, which you mark with a traversal.
  4. 4. What is the best use of this map?

    Patterns are learned by deliberate repetition with attention to the signal that selects the technique.

Summary

  • 100 classic problems fall into about 11 families; the family tells you the technique.
  • Solve first, then compare with the lesson; record the signal that led to the technique.
  • Statement keywords (sorted, subarray, k-th, prerequisite, parentheses) are strong hints.
  • Always give the brute force and its cost before optimizing, and revisit misses after a delay.

Next: Practice Problem Sets