Master LeetCode 414 — Third Maximum Number. Learn the subtle INT_MIN sentinel trap, two clean approaches (sorted set + three-variable O(1)), and real FAANG follow-up questions interviewers ask after you solve it.
Learn why 3Sum is a FAANG interview staple — how sorting enables two pointers, why deduplication trips up even strong candidates, a full visual dry run, and every common bug explained with Python and JavaScript solutions.
Master the classic Merge Intervals problem (LeetCode 56) asked at Google, Meta, Amazon, and Microsoft. Learn why sorting by start time is the key insight, the exact overlap condition (c ≤ b), a step-by-step visual dry run, 4 common mistakes, Python and JavaScript solutions, and follow-up problems including Insert Interval, Non-overlapping Intervals, and Meeting Rooms II.
LeetCode 347 asks for k most frequent elements with a constraint: beat O(n log n). Learn why naive sort fails, how a min-heap of size k achieves O(n log k), and the elegant bucket sort insight that delivers true O(n) — with full visual dry run, common mistakes, and Python/JavaScript solutions for all three approaches.
LeetCode 324 — asked at Google and Amazon. Rearrange an array so nums[0] < nums[1] > nums[2] < nums[3]... The key insight: find the median, then use a virtual index mapping to interleave smaller and larger halves without adjacent equal elements. O(n) time with nth_element.
Most candidates jump straight to sorting. Learn the O(n) one-pass trick that finds the minimum and maximum of the violated region, expands the boundary correctly, and handles all edge cases — plus every FAANG follow-up interviewers actually ask.
Count spell-potion pairs where spell * potion >= success by sorting potions and binary searching for each spell threshold. Full FAANG-level breakdown with visual dry run, all edge cases, and ceiling division intuition.
Answer range-coverage queries offline by sorting both intervals and queries, sweeping through with a min-heap ordered by interval size — a canonical offline query pattern.
For each interval, find the one with the smallest start point greater than or equal to its end — a clean binary search problem that teaches index-preserving sort patterns.
Sort an array by element frequency ascending (ties broken by value descending) using a frequency map and custom comparator — a clean problem that tests mastery of custom sort keys.
LC 881 asks for the minimum boats to rescue everyone given a weight limit and at-most-2-per-boat rule. Sort then greedily pair the heaviest with the lightest using two pointers — O(n log n) time, O(1) space.
LC 15 asks for all unique triplets summing to zero. Sort the array, fix each element as the anchor, and use two pointers to scan for pairs — with careful three-level deduplication. A must-know FAANG pattern.
LC 1984 asks for the minimum max-minus-min over any k chosen scores. The optimal k scores are always contiguous in sorted order — sort once then scan windows of size k in O(n log n) time, O(1) space.