Two Sum is the #1 most-asked interview problem at Google, Amazon, and Meta — confirmed in over 170 interviews at 70 companies. But it is not about the solution. It is about showing you can trade space for time, recognize the hashmap complement pattern, and handle every follow-up a senior engineer can throw at you.
Learn why LeetCode 121 is a FAANG staple — not because it is hard, but because of what it reveals about your thinking. Master the running-minimum insight, avoid the global min/max trap, and understand all five stock variants from 121 to 309.
LC 217 looks trivially easy — but FAANG interviewers use it to probe your hashset vs sorting instincts, your ability to articulate space-time trade-offs, and whether you can spot the follow-up traps in LC 219 and LC 220. Full solutions in Python and JavaScript with deep explanation.
Most explanations of Kadane's Algorithm get it subtly wrong. Learn the correct mental model, the critical reset-to-0 bug that trips everyone up, a full visual dry run, divide-and-conquer alternative, and every FAANG follow-up question with approach hints.
LeetCode 283 is the gateway to the two-pointer partition pattern used across dozens of harder problems. Learn why it appears in almost every Microsoft and Amazon phone screen, master the write-pointer mental model with a step-by-step dry run, and understand when to swap vs. overwrite — with Python and JavaScript solutions fully annotated.
LeetCode 66 looks trivial until you hit [9,9,9]. Learn why interviewers love this problem, how carry propagation cascades through digits, the critical all-9s edge case that requires a new array, and why early termination makes your solution elegant — with Python and JavaScript solutions fully explained.
Most candidates try to merge nums1 and nums2 from the front and run into a subtle overwrite bug. Learn why starting from the back is the key insight, how three pointers keep the logic clean, and how this same trick powers the merge step in Merge Sort. Full Python and JavaScript solutions included.
Master the write pointer pattern — the canonical technique for in-place array modification. Full walkthrough of LeetCode 26 with visual dry run, common mistakes, and the LC 80 generalization. Python and JavaScript solutions included.
Find the one element that appears once while every other appears twice. The XOR bit trick delivers O(n) time and O(1) space — no extra memory, no sorting. Master the three XOR properties that make it work, then see how interviewers escalate to Single Number II and III.
Two problems, one pair of concepts: LC 349 asks for the unique intersection (HashSet), LC 350 asks for the frequency-aware intersection (HashMap). Master all three approaches for LC 349 — HashSet, sort+two pointers, binary search — then learn why the follow-up questions on LC 350 are what Google and Amazon actually care about: sorted input, skewed sizes, and data that does not fit in memory.
Master Pascal's Triangle (LeetCode 118 & 119) by understanding the binomial coefficient connection, the row-by-row DP pattern, space-optimized O(k) single-row generation, and five hidden mathematical properties that show up in Unique Paths, Coin Change, and beyond.
Master LeetCode 242 Valid Anagram with three approaches — sort O(n log n), 26-element frequency array O(n)/O(1), and HashMap O(n)/O(k). Includes a visual dry run, the critical Unicode follow-up, and the direct connection to Group Anagrams (LC 49).
Master LeetCode 125 — Valid Palindrome with the O(1)-space two-pointer technique. Learn why every FAANG loop starts here, visualize the pointer walk on a classic example, avoid the four most common pitfalls, and unlock the palindrome follow-up chain: LC 680, LC 5, and LC 647.
Find the longest common prefix string among an array of strings. Covers vertical scan O(n*m), horizontal scan, binary search, and Trie approaches with all 5 language solutions.
Count the number of prime numbers strictly less than n. Master the Sieve of Eratosthenes — one of the most elegant algorithms in CS — with full code in C, C++, Java, JavaScript and Python.
LeetCode 268 hides four distinct valid solutions behind a deceptively simple problem. Learn Sort, HashSet, Gauss Formula, and XOR — understand exactly why each exists, when interviewers ask for each one, and why XOR is the most elegant answer in the room.
The Boyer-Moore Voting Algorithm solves LeetCode 169 in O(n) time and O(1) space using a brilliantly counterintuitive cancellation trick. Learn the proof, the dry run, all four approaches, and why interviewers love this problem — plus the Majority Element II follow-up that extends the same idea to two candidates.
Compute running (prefix) sum in O(n) time O(1) extra space. The prefix sum pattern is foundational for range queries, subarray problems and 2D matrices.
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.
LeetCode 11 explained from scratch: why this is a greedy problem, the formal proof that you must always move the shorter pointer, a full step-by-step dry run, common traps, and clean Python + JavaScript solutions. Master the pointer-elimination pattern that appears throughout FAANG interviews.
LeetCode 238 is one of the most frequently asked medium problems at Google and Meta. Learn why the no-division constraint is intentional, how the prefix × suffix insight unlocks the O(n) solution, and how a single running variable eliminates the extra O(n) space entirely.
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.
Traverse an m×n matrix in spiral order. Master the boundary-shrinking technique — maintain top, bottom, left, right walls and peel layer by layer. Covers edge cases, visual dry run, common bugs, Python & JavaScript solutions, and follow-ups like Spiral Matrix II.
Group strings that are anagrams of each other using two canonical approaches: sorted string key O(n·k·log k) and character frequency tuple key O(n·k). Understand when the difference matters, trace through a dry run, dodge the common traps, and leave any interview with both solutions ready to go.
LeetCode 560 is one of the most-asked FAANG problems because it teaches the prefix sum + hashmap pattern — a technique that handles negative numbers, generalizes to a dozen follow-ups, and cannot be replaced by sliding window. Learn the insight, the dry run, the common mistakes, and the O(n) solution in Python and JavaScript.
LeetCode 33 is a rite of passage in FAANG interviews. Learn the one invariant that makes O(log n) possible on a rotated array, trace through a dry run, avoid the 4 most common bugs, and master the full family of follow-up problems (LC 81, LC 153, LC 154).
LeetCode 55 is a classic FAANG greedy problem that tests whether you can compress O(n²) DP thinking into a single O(n) pass. Learn the "max reachable index" insight, why greedy beats DP here, a full visual dry run, common traps, and every follow-up question interviewers ask next.
LeetCode 189 looks trivial — until the interviewer asks for O(1) space. Learn why three distinct approaches exist, the mathematical reason triple-reverse works, every common pitfall (wrong k, direction confusion, off-by-one), a full visual dry run, and how this trick unlocks Rotate String, Rotate Image, and beyond.
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 152 looks like a simple extension of Maximum Sum Subarray — until you hit negative numbers. A negative times a negative is positive, which means the current minimum can instantly become the new maximum. Learn why tracking BOTH cur_max and cur_min is the essential insight, how zeros act as hard resets, the four bugs every candidate makes, and step-by-step dry runs on key examples. Python and JavaScript solutions from O(n²) brute force to the elegant O(n) DP approach.
Learn how to rotate an n×n matrix 90° clockwise in-place using the elegant transpose-then-reverse trick. Understand the math behind it, see the 4-cell direct rotation alternative, dry-run through a worked example, avoid the four most common mistakes, and get clean Python + JavaScript solutions.
Next Permutation is not just an array problem — it is a test of systematic algorithmic thinking under pressure. Learn why you scan from the right, why you swap with the smallest larger element, and why the suffix is reversed rather than sorted. Includes full visual dry runs, the 4 most common bugs, and Python + JavaScript solutions.
LeetCode 287 eliminates every naive approach through three hard constraints: no array modification, O(1) space, O(n) time. The solution — treating the array as an implicit linked list and running Floyd's tortoise-and-hare cycle detection — is one of the most elegant algorithm mappings in all of DSA. Full proof, visual dry run, Python and JavaScript solutions.
Master Dijkstra's Dutch National Flag algorithm to sort 0s, 1s, and 2s in a single pass with O(1) space. Understand the three-pointer invariants, the critical bug most candidates make, and how this pattern unlocks a family of partition problems.
LeetCode 739 — Find the number of days until a warmer temperature for each day using a monotonic decreasing stack. The key insight: store indices, not temperatures, in the stack. When a warmer day arrives, it is the "next greater element" for every cooler day still waiting on the stack — a fundamental pattern that appears in at least six other LeetCode problems.
LeetCode 128 — Find the longest consecutive integer sequence in O(n) using a HashSet. The trick: only start counting from numbers where num-1 is NOT in the set, so each element is visited at most twice total across the entire algorithm.
LeetCode 42 is a benchmark Hard problem used by Amazon, Google, and Meta to test whether you can derive an insight — not just memorize code. Learn all three approaches (brute force, prefix arrays, two pointers) and — crucially — understand WHY the two-pointer invariant works.
Most candidates brute-force this in O(n·k) and hit TLE. Learn the monotonic deque invariant that reduces it to O(n) — with a step-by-step dry run, the five common bugs that break implementations, and why this pattern unlocks Jump Game VI and Constrained Subsequence Sum.
LeetCode 41 is a landmark Hard problem because both obvious approaches — hash set and sorting — are explicitly banned by the constraints. Learn the mathematical insight that bounds the answer to [1, n+1], then master two O(n) time, O(1) space techniques: index marking via sign negation and cyclic sort placement, with a full visual dry run, bug catalogue, and FAANG follow-ups.
Master LeetCode 84 the right way. Learn exactly why bars are popped from the monotonic stack, how to calculate left/right boundaries without bugs, the sentinel-values trick that eliminates edge cases, and a step-by-step dry run on [2,1,5,6,2,3] — plus how this pattern extends directly to Maximal Rectangle (LC 85).
Master LeetCode 76 — the gold-standard Hard sliding window problem asked at Google, Meta, and Amazon. Learn the "formed" counter trick that reduces window validity checks from O(|t|) to O(1), trace through a full dry run, and avoid the five bugs that trip up 90% of candidates.
LeetCode 4 is one of the most feared Hard problems in FAANG interviews. Learn exactly why the partition insight works, trace through a full binary search dry run, understand the five common bugs that cause silent wrong answers, and walk away with production-quality Python and JavaScript solutions.
JavaScript array methods are the bread and butter of every developer. map, filter, reduce, find, flat, flatMap — knowing when to use which transforms messy loops into clean, readable code. Here's your complete, practical reference.