Top 20 FAANG Coding Interview Problems (and What Each One Teaches)

May 29, 202616 min read
interview-prepdsaleetcodealgorithms
Top 20 FAANG Coding Interview Problems (and What Each One Teaches)
TL;DR
  • FAANG coding interview problems cluster around 20 questions confirmed at two or more big five companies in 2024 and 2025 candidate reports.
  • Pattern absorption beats memorization: each problem encodes a technique that transfers to a whole family of questions.
  • The silent containment bug in Merge Intervals (writing next.end instead of max(current.end, next.end)) fails more candidates than any other single-line mistake on the list.
  • Sliding window problems like Minimum Window Substring and Longest Substring appear at all five companies because they exercise the full template, not just half of it.
  • Design problems like LRU Cache and Find Median from Data Stream test structural intuition: the sentinel node trick and the two-heap invariant are the entire lessons.
  • The outer loop over all cells in Number of Islands is not optional — every grid connectivity problem requires it to catch disconnected components.
  • Practice blind: no tags, no hints, timer on, then debrief on the structural signal you missed, not just whether your answer was correct.

The same problems keep showing up. Across thousands of candidate reports on Blind, LeetCode Discuss, and interviewing.io, the same cluster emerges: problems that appear at multiple companies, problems that get re-skinned into harder variants, and problems that are essentially pop quizzes on patterns you'll need repeatedly. The goal isn't to memorize 20 solutions. It's to absorb 20 patterns through the problems that encode them most cleanly.

Each problem on this list appeared at two or more of the big five in 2024 and 2025 candidate reports. Each one also teaches something that transfers to a whole family of questions. That's the bar.


20 FAANG Problems at a Glance

#ProblemLC #PatternWhere It Shows Up
1Two Sum1Hash map complementAll five
2Longest Substring Without Repeating Chars3Sliding windowAll five
3Trapping Rain Water42Two pointersGoogle, Amazon, Meta
4Maximum Subarray53Kadane's DPAll five
5Merge Intervals56Sort + greedyGoogle, Meta, Amazon
6Word Search79Backtracking + DFSMeta, Amazon, Apple
7Validate Binary Search Tree98Recursive boundsGoogle, Apple, Amazon
8Binary Tree Level Order Traversal102BFS layer snapshotAll five
9Clone Graph133BFS + hash mapMeta, Google
10Word Break139String DPAll five
11LRU Cache146HashMap + doubly linked listAll five
12Course Schedule207Topological sortGoogle, Meta, Amazon
13Meeting Rooms II253Heap + interval schedulingAmazon, Meta, Apple
14Find Median from Data Stream295Two heapsGoogle, Amazon, Apple
15Coin Change322Bottom-up DPGoogle, Amazon, Meta
16Top K Frequent Elements347Heap / bucket sortAll five
17Number of Islands200BFS/DFS on gridsAll five
18Minimum Window Substring76Sliding window (hard)All five
19Serialize and Deserialize Binary Tree297Tree traversal + designAll five
20Longest Palindromic Substring5Expand from centerGoogle, Amazon, Apple

Problems 1-5: The Foundation (Where Most Candidates Already Lose)

1. Two Sum: The Brute-Force Rejection Test

Two Sum is a 5-minute warm-up at Amazon and Meta. Sometimes it's literally the first question at Apple. It's also the problem where a surprising number of candidates write a nested loop and then look up expectantly, waiting for applause.

The test isn't whether you know hash maps. It's whether you instinctively reject O(n²). The nested-loop solution is obvious. The interviewer is watching whether you offer it and move on, or spend two minutes defending it like a lawyer.

What it teaches: complement lookup, hash map as "have I seen this before?" The same O(n) intuition shows up in every subsequent hash map problem.

2. Longest Substring Without Repeating Characters: The Window Invariant

The variable-width sliding window in its clearest form. Maintain a window with a hash map tracking character counts. When a duplicate enters, advance the left pointer until it's gone. Simple concept. Surprisingly many ways to write it slightly wrong.

If you can articulate the loop invariant here (every character in the window appears exactly once), you can construct 80% of sliding window solutions on demand. Most candidates code this correctly. Fewer can explain why their boundary conditions are right. Fewer still can explain it out loud while also typing. That's the skill gap.

What it teaches: variable-width sliding window, shrink-on-violation logic. Direct prerequisite for Minimum Window Substring. See the sliding window pattern for the full template.

3. Trapping Rain Water: Bounds Without Precision

The brute force is O(n²). Precomputed max arrays get you O(n) time with O(n) space. The two-pointer approach is O(1) space. The interviewer will ask you to optimize twice. Plan accordingly.

The two-pointer insight is the real test: when leftMax is smaller than rightMax, you don't need the exact right maximum to process the current left cell. You only need to know it's at least rightMax. That reasoning, knowing a lower bound suffices and you don't need the precise value, reappears in several other problems where you'd otherwise feel stuck.

What it teaches: two-pointer correctness reasoning, "a lower bound suffices" logic.

4. Maximum Subarray: DP in Its Smallest Possible Form

Kadane's algorithm. Two variables. One recurrence: best = max(nums[i], best + nums[i]). Designed in roughly one minute at Carnegie Mellon in 1984, which makes every candidate who stares at it blankly for ten minutes feel slightly worse.

Initialize to nums[0], not 0, or every all-negative test case fails silently. This is a rite of passage bug.

This problem earns its spot because it introduces the DP recurrence shape in the smallest possible wrapper. "Extend the current run or restart from here." Once you see this shape, you recognize it in stock prices, circular arrays, and product subarray problems.

What it teaches: single-variable recurrence DP, the all-negative edge case.

5. Merge Intervals: The Silent Containment Bug

Sort by start time, check if the next interval overlaps the current one, merge if so. Feels easy. Is not.

The bug that fails the most candidates: writing current.end = next.end instead of current.end = max(current.end, next.end). When one interval contains another, the inner one's end is smaller. That single-line mistake produces a wrong answer on the hidden test cases, and the code looks completely correct on a quick read. This is the kind of bug that gets you after 40 minutes of a hard problem, when your guard is down. See the merge intervals pattern for the full family.

What it teaches: sorting as preprocessing, the containment edge case, the max-in-merge-step discipline.


Problems 6-10: The Medium Core

6. Word Search: Backtracking With In-Place Mutation

DFS on a 2D grid with backtracking. Mark a cell visited by overwriting it with '#', recurse into neighbors, then restore the original character before returning. It looks destructive. It isn't. That's the point.

The in-place mutation trick eliminates the need for a separate visited matrix and avoids aliasing bugs that come from passing a mutable structure through recursive calls. Candidates who don't know this either allocate O(m*n) extra space or introduce subtle bugs in the visited tracking. Both cost time you don't have.

What it teaches: backtracking on grids, state mutation and restoration, the mark-and-restore pattern.

7. Validate Binary Search Tree: Threading Bounds Through Recursion

The first instinct is to check left.val < node.val < right.val locally. That fails on a perfectly valid-looking tree where a deep node violates a distant ancestor's constraint. Every interviewer has seen this wrong answer. Many have a specific follow-up question ready for when you produce it.

The correct solution threads bounds downward: every node in a subtree must satisfy every ancestor's constraint, not just its parent's. This parameter-threading pattern appears in several other tree problems and is exactly what interviewers probe with follow-up questions.

What it teaches: recursive tree reasoning with accumulated constraints. Also solvable via inorder traversal, since a valid BST produces a sorted inorder sequence.

8. Binary Tree Level Order Traversal: The Queue Snapshot

Standard BFS, with one implementation detail that matters. The inner loop is for _ in range(len(queue)), which freezes the current level's count before you start appending children. Without this, children from the current level contaminate the count for the next.

Get the snapshot wrong and your output conflates levels. This one line is the entire lesson. It applies to zigzag traversal, right side view, level averages, and every other level-by-level tree problem. One line. Write it correctly. Explain why it's there.

What it teaches: BFS layer separation, the queue-snapshot trick. See BFS vs DFS for when to reach for each.

9. Clone Graph: The Dual-Purpose Hash Map

BFS from the source. Maintain a hash map from old node to cloned node. That's literally it.

The hash map does double duty: it's the visited set and the cloned-node registry in the same data structure. Candidates who allocate a separate visited set and a separate clones map always have a harder time. Once you see it as one structure, the code simplifies immediately. If you can explain that dual role out loud without being asked, you get a checkmark on the communication dimension.

What it teaches: BFS with cycle avoidance, the registry-as-visited-set pattern.

10. Word Break: Coin Change in a Different Costume

Given a string and a dictionary, determine if the string can be segmented into dictionary words. dp[i] is true if the prefix of length i can be built from the dictionary. This is Coin Change wearing a trench coat and a hat.

If you understand Coin Change, Word Break follows immediately. Same shape, different domain. For each end position i, find any split point j where dp[j] is true and s[j:i] is in the word set. See the DP framework for how to build this pattern recognition instinct before the interview rather than during it.

What it teaches: string DP, the "valid split exists?" recurrence, set-based dictionary lookup.


Problems 11-15: Design and Classic DP

11. LRU Cache: Two Structures, One Design Problem

HashMap for O(1) lookup. Doubly linked list for O(1) insertion and deletion at arbitrary positions. Two sentinel nodes (head and tail dummies) eliminate every null-check edge case.

The sentinel node trick is the entire lesson. Without sentinels, every insertion and deletion requires branches to handle head and tail cases. With them, every operation is the same three pointer reassignments regardless of position. Interviewers watch whether you discover sentinels on your own or need a hint. Be the person who discovers them.

What it teaches: linked list and hash map fusion, sentinel nodes in design problems.

12. Course Schedule: Cycle Detection, Stated Plainly

Given course prerequisites as a directed graph, determine if you can finish all courses. Which is: detect a cycle in a directed graph. BFS (Kahn's algorithm) counts in-degrees and processes zero-in-degree nodes until done. DFS uses three colors to detect back edges.

The real interview question here is "can you detect a cycle and explain why your algorithm is correct?" Either approach works. What fails candidates is implementing one they cannot justify. Pick the one you can defend, not the one that sounds more impressive.

What it teaches: directed cycle detection, topological sort. Foundation for Course Schedule II and any dependency resolution problem.

13. Meeting Rooms II: Counting With a Heap

Minimum conference rooms for a set of meetings. Sort by start time. Maintain a min-heap of end times. If the next meeting starts after the heap's minimum, reuse that room. Otherwise add one.

This is Merge Intervals with a resource counter, but it doesn't feel that way at first. Recognizing that you need to track the earliest available end time, not just whether intervals overlap, is harder than the implementation. The heap isn't obvious unless you've seen this type of resource-counting problem before. Now you have.

What it teaches: interval scheduling with resource counting, heap as a "who finishes soonest?" tracker.

14. Find Median from Data Stream: The Two-Heap Invariant

A max-heap for the lower half, a min-heap for the upper half. Maintain the invariant that heaps are equal size or the lower half is one larger. The median is the top of the larger heap, or the average of both tops when they're equal.

The two-heap trick solves a specific class of problems: you need a fixed-rank element on a dynamic stream and a sorted structure is too slow. Recognizing this as a two-heap problem before you start coding is the entire challenge. The implementation is surprisingly short once the design is clear.

What it teaches: two-heap design, maintaining size invariants across insertions.

15. Coin Change: The Canonical 1D DP Table

dp[amount] is the minimum coins needed. Initialize to infinity, set dp[0] = 0. For each amount from 1 to target, try every coin denomination and take the minimum.

Coin Change is worth practicing not because it appears constantly, but because building its DP table by hand is the clearest demonstration of what bottom-up DP actually means. Fill in topological order of the dependency DAG, each answer feeding the next. Once this clicks, every 1D DP problem becomes setup rather than insight. Build the table. By hand. On paper. This is not optional.

What it teaches: 1D DP with inner loop over choices, "infinity for impossible" initialization.


Problems 16-20: Graphs, Heaps, and Strings

16. Top K Frequent Elements: When Bucket Sort Beats a Heap

Heap approach: frequency map, then push onto a min-heap of size k. O(n log k). Bucket sort approach: buckets indexed by frequency, iterate from the highest-frequency bucket. O(n).

Explaining the bucket sort approach is the signal that separates candidates. The heap solution gets you a correct answer. The bucket explanation gets you a "tell me more." The bucket insight (an element can appear at most n times, so you can index by frequency directly) is the kind of bounded-domain observation that shows you think in complexity.

What it teaches: heap vs bucket sort tradeoff, frequency-as-index insight, when bounded domain information breaks O(n log n) floors.

17. Number of Islands: The Mandatory Outer Loop

BFS or DFS on a 2D grid. For each unvisited land cell, start a traversal and mark every reachable land cell visited. Count traversals.

The outer loop over all cells is not optional. Many candidates code the traversal correctly but start only from (0,0), missing every island unreachable from the corner. It's the grid equivalent of running DFS from a single source on a disconnected graph. Every grid connectivity problem requires an outer loop to handle disconnected components. This is not a subtle point. It is a surprisingly common failure mode.

What it teaches: connected components on grids, the outer-loop discipline for disconnected graphs.

18. Minimum Window Substring: The Full Sliding Window Toolkit

Two hash maps (have and need), two counters tracking how many characters are currently satisfied, expand right until valid, shrink left while valid. The full sliding window template, executed under pressure.

This problem appears at all five companies because it exercises the complete pattern, not just half of it. Easy to understand conceptually. Hard to write correctly in 25 minutes without having done it before. The candidates who breeze through it have practiced writing the full template from scratch, not just recognized the concept.

What it teaches: the have/need counter pattern, minimum window shrinking logic.

19. Serialize and Deserialize Binary Tree: Design Before You Code

Design two functions: one converts a tree to a string, one converts it back. Preorder DFS with null markers works cleanly. BFS works too. Your choice. But you have to make the choice deliberately.

The thing interviewers watch is whether you design the encoding format before writing a single line of code. What's the delimiter? How do you represent null? Candidates who start coding first make the implementation three times harder and often produce an ambiguous format they cannot parse back. Spec the format. Out loud. Before touching the keyboard.

What it teaches: encoding/decoding design, recursive tree construction from a serialized format.

20. Longest Palindromic Substring: Two Centers, Not One

Expand from each index outward. Odd-length palindromes have a character center. Even-length palindromes have a gap center between two adjacent characters. You need both loops.

Candidates who only handle odd-length palindromes fail every even-length test case silently. The code runs. No error. Wrong answer. This is the kind of bug that's invisible under time pressure and only shows up on the cases you forgot to test. The two-center loop is the entire correctness difference. Test even-length palindromes first.

What it teaches: expand-from-center technique, odd vs even palindrome center distinction. Foundation for Manacher's O(n) algorithm.


What These 20 Actually Cover

Together the list spans hash maps, variable and fixed sliding windows, two pointers, 1D DP, string DP, sort-plus-greedy, BFS layer traversal, DFS and backtracking on grids and graphs, heap design, directed cycle detection, and interval scheduling. Solving all 20 gives you a clear picture of which patterns still feel uncertain. Those are your prep targets for week two.

One rule: do each problem blind. No tags, no hints, timer on. When you finish (or time out), debrief on what structural signal you missed, not just whether you got the answer. Pattern recognition is the actual skill. The code is just the output.


Before You Start: The Part Most Guides Skip

The solutions in your head don't produce a strong hire signal if you go silent under pressure. There's a real gap between "I know this" and "I can explain this while typing." SpaceComplexity runs voice-based mock interviews so you practice narrating your approach in real time, not just writing it. That gap is exactly what separates the candidates who pass from the ones who replay the interview on the drive home wondering what went wrong.


Further Reading