📝 Interview Walkthroughs
Step-by-step guides to solving top coding interview problems. Each walkthrough covers the optimal strategy,
common mistakes, complexity analysis, and what a strong candidate sounds like.
📖 Looking for a study plan? Read the complete coding interview preparation guide.
Arrays (20)
-
Best Time to Buy and Sell Stock
easyA step-by-step walkthrough of Best Time to Buy and Sell Stock as it unfolds in a real coding interview. Learn the greedy O(n) approach, common mistakes, and how strong candidates communicate the solution.
-
Contains Duplicate
easyHow to solve Contains Duplicate (LeetCode #217) in a coding interview. Covers hash set vs. sorting trade-offs, early exit optimization, the follow-up question, and what interviewers are really testing.
-
Longest Palindrome
easyMaster Longest Palindrome for your coding interview. Learn the pairs-plus-center greedy pattern, frequency counting, and what interviewers actually evaluate.
-
Majority Element
easyHow to solve Majority Element (LeetCode #169) in a coding interview. Covers hash map, sorting, and Boyer-Moore Voting Algorithm approaches with the cancellation intuition explained clearly.
-
Meeting Rooms
easyMaster Meeting Rooms for your coding interview. Learn the sort-then-scan interval pattern, overlap detection, and what interviewers actually evaluate.
-
Ransom Note
easyMaster Ransom Note for your coding interview. Learn character frequency counting, the 26-element array optimization, and what interviewers actually evaluate.
-
Two Sum
easyA step-by-step walkthrough of the Two Sum problem as it unfolds in a real coding interview. Learn the optimal hash map approach, common mistakes, and how strong candidates communicate their solution.
-
3Sum
mediumA step-by-step guide to solving the 3Sum problem in a coding interview: brute force to optimal O(n²) with sorting, two pointers, and duplicate handling explained clearly.
-
Container With Most Water
mediumA step-by-step walkthrough of LeetCode #11 as it plays out in a real coding interview. Learn the two-pointer technique, the greedy argument for why it's correct, and the proof that moving the shorter pointer never misses the optimal pair.
-
Find All Anagrams in a String
mediumMaster Find All Anagrams in a String for your coding interview. Learn the fixed-size sliding window, the matches counter optimization, and what interviewers actually evaluate.
-
Insert Interval
mediumMaster Insert Interval for your coding interview. Learn the three-case linear scan, merge boundary conditions, and what interviewers actually evaluate.
-
K Closest Points to Origin
mediumMaster K Closest Points to Origin for your coding interview. Learn the max-heap approach, Quickselect, why sqrt is unnecessary, and what interviewers actually evaluate.
-
Maximum Subarray
mediumA step-by-step guide to solving Maximum Subarray in a coding interview: Kadane's algorithm, the greedy reset decision, the DP framing, all-negative edge cases, and the follow-up questions interviewers use to probe depth.
-
Merge Intervals
mediumA step-by-step walkthrough of the Merge Intervals problem as it unfolds in a real coding interview. Learn the optimal approach, common mistakes, and how strong candidates communicate their solution.
-
Product of Array Except Self
mediumA step-by-step walkthrough of LeetCode #238 as it unfolds in a real coding interview. Learn the prefix/suffix product technique, the O(1) space optimization, and the edge cases that catch even prepared candidates.
-
Sort Colors
mediumMaster Sort Colors for your coding interview. Learn the Dutch National Flag algorithm, three-pointer invariants, and what interviewers actually evaluate.
-
Spiral Matrix
mediumMaster Spiral Matrix for your coding interview. Learn boundary-shrinking traversal, edge cases for non-square matrices, and what interviewers actually evaluate.
-
Task Scheduler
mediumA step-by-step walkthrough of the Task Scheduler problem as it unfolds in a real coding interview. Learn the greedy formula approach, the heap-based simulation alternative, and how strong candidates derive the scheduling formula from first principles.
-
Find Median from Data Stream
hardA step-by-step walkthrough of the Find Median from Data Stream problem as it unfolds in a real coding interview. Learn the two-heap approach, the rebalancing invariant, and how to simulate a max-heap in Python.
-
Trapping Rain Water
hardA step-by-step guide to solving Trapping Rain Water in a coding interview: the geometric insight, prefix/suffix arrays, and the two-pointer O(1) space technique explained clearly.
Linked Lists (6)
-
Linked List Cycle
easyA step-by-step guide to solving Linked List Cycle in a coding interview: Floyd's tortoise and hare algorithm, the hash set baseline, the mathematical proof of why pointers meet, and what strong candidates sound like.
-
Merge Two Sorted Lists
easyA step-by-step guide to solving Merge Two Sorted Lists in a coding interview: the dummy node pattern, iterative and recursive approaches, pointer mistakes to avoid, and what strong candidates sound like.
-
Middle of the Linked List
easyMaster Middle of the Linked List for your coding interview. Learn the fast-slow pointer pattern, even-length list handling, and what interviewers actually evaluate.
-
Reverse Linked List
easyA step-by-step guide to solving Reverse Linked List in a coding interview: the three-pointer iterative technique, the recursive approach, pointer mistakes to avoid, and what strong candidates sound like.
-
LRU Cache
mediumA step-by-step guide to solving LRU Cache in a coding interview: from naive lists to the optimal hash map + doubly linked list design, with pointer operations and sentinel nodes explained.
-
Merge K Sorted Lists
hardA step-by-step walkthrough of LeetCode #23 as it plays out in a real coding interview. Learn the min-heap K-way merge pattern, the Python tiebreaker trick, and the divide-and-conquer alternative that uses O(1) extra space.
Trees (12)
-
Balanced Binary Tree
easyA step-by-step walkthrough of the Balanced Binary Tree problem as it unfolds in a real coding interview. Learn the O(n²) trap, the bottom-up sentinel technique, and how strong candidates avoid redundant work.
-
Diameter of Binary Tree
easyMaster Diameter of Binary Tree for your coding interview. Learn the DFS-with-side-effect pattern, why the path may not pass through root, common mistakes, and what interviewers evaluate.
-
Invert Binary Tree
easyA step-by-step guide to solving Invert Binary Tree in a coding interview: recursive and iterative approaches, tree traversal reasoning, edge cases, and what strong candidates sound like.
-
Lowest Common Ancestor of a Binary Search Tree
easyMaster Lowest Common Ancestor of a BST for your coding interview. Learn the split-point insight, iterative O(1) solution, and what interviewers actually evaluate.
-
Maximum Depth of Binary Tree
easyMaster Maximum Depth of Binary Tree for your coding interview. Learn recursive DFS, iterative BFS, common mistakes, and what interviewers actually evaluate.
-
Binary Tree Level Order Traversal
mediumA step-by-step guide to solving Binary Tree Level Order Traversal in a coding interview. Learn the BFS queue-snapshot pattern, common mistakes, and what interviewers actually score you on.
-
Binary Tree Right Side View
mediumHow to solve Binary Tree Right Side View (LeetCode #199) in a coding interview using BFS level-order traversal. Includes both BFS and DFS approaches, complexity analysis, common mistakes, and interview dialogue.
-
Construct Binary Tree from Preorder and Inorder Traversal
mediumA step-by-step walkthrough of Construct Binary Tree from Preorder and Inorder Traversal as it unfolds in a real coding interview. Learn the recursive reconstruction algorithm, the hash map optimization, and how to avoid common index-tracking mistakes.
-
Kth Smallest Element in a BST
mediumMaster Kth Smallest Element in a BST for your coding interview. Learn the in-order traversal shortcut, iterative early-exit, and the augmented-tree follow-up.
-
Lowest Common Ancestor of a Binary Tree
mediumA step-by-step walkthrough of LeetCode #236 as it plays out in a real coding interview. Learn the single-pass postorder DFS approach, why BST solutions don't work here, and how to handle the self-ancestor edge case.
-
Validate Binary Search Tree
mediumA step-by-step walkthrough of LeetCode #98 as it plays out in a real coding interview. Learn the bounds-propagation technique, why the naive local-check approach fails, and the edge cases that catch even experienced candidates.
-
Serialize and Deserialize Binary Tree
hardA step-by-step walkthrough of Serialize and Deserialize Binary Tree as it unfolds in a real coding interview. Learn both BFS and DFS approaches, how to encode null nodes, and why the DFS preorder solution is the cleanest interview implementation.
Graphs (9)
-
Flood Fill
easyMaster Flood Fill for your coding interview. Learn the grid DFS/BFS pattern, boundary handling, infinite loop prevention, and what interviewers actually evaluate.
-
01 Matrix
mediumA step-by-step walkthrough of the 01 Matrix problem as it unfolds in a real coding interview. Learn multi-source BFS, why seeding from zeros beats seeding from ones, and how strong candidates explain the approach.
-
Accounts Merge
mediumA step-by-step walkthrough of the Accounts Merge problem as it unfolds in a real coding interview. Learn the Union-Find approach, why name-based merging fails, and how to reconstruct sorted email groups.
-
Clone Graph
mediumMaster Clone Graph for your coding interview. Learn the DFS clone-map pattern, cycle handling, and what interviewers actually evaluate.
-
Course Schedule
mediumA step-by-step guide to solving Course Schedule in a coding interview. Learn DFS three-state cycle detection on directed graphs, common mistakes, and what interviewers actually score you on.
-
Minimum Height Trees
mediumA step-by-step walkthrough of the Minimum Height Trees problem as it unfolds in a real coding interview. Learn the leaf-trimming algorithm, why MHT roots are always the tree's center nodes, and how to implement the solution in O(n).
-
Number of Islands
mediumA step-by-step guide to solving Number of Islands in a coding interview: grid-as-graph modeling, DFS vs BFS tradeoffs, in-place marking, and complexity analysis explained clearly.
-
Rotting Oranges
mediumMaster Rotting Oranges for your coding interview. Learn multi-source BFS, layer-by-layer traversal, and what interviewers actually evaluate.
-
Word Ladder
hardA step-by-step walkthrough of the Word Ladder problem as it unfolds in a real coding interview. Learn why BFS is the right tool, the neighbor-generation trick, and how bidirectional BFS cuts the search space.
Dynamic Programming (6)
-
Climbing Stairs
easyA step-by-step walkthrough of the Climbing Stairs problem as it unfolds in a real coding interview. Learn the full recursion-to-DP progression, the Fibonacci connection, and how strong candidates communicate their optimization steps.
-
Coin Change
mediumA step-by-step guide to solving the Coin Change problem in a coding interview: from recursive brute force to optimal bottom-up DP with recurrence derivation and greedy failure analysis.
-
Partition Equal Subset Sum
mediumHow to solve Partition Equal Subset Sum (LeetCode #416) in a coding interview using 0/1 knapsack DP. Covers the key reduction, space-optimized 1D DP, reverse iteration insight, and common mistakes.
-
Unique Paths
mediumMaster Unique Paths for your coding interview. Learn the 2D DP recurrence, 1D space optimization, the combinatorics shortcut, and what interviewers actually evaluate.
-
Word Break
mediumA step-by-step walkthrough of LeetCode #139 as it plays out in a real coding interview. Learn the DP recurrence, why naive recursion explodes exponentially, and the base case that trips up most candidates.
-
Maximum Profit in Job Scheduling
hardA step-by-step walkthrough of the Maximum Profit in Job Scheduling problem as it unfolds in a real coding interview. Learn the DP + binary search approach, the sorting prerequisite, and how to implement the clean dp-array pattern.
Strings (7)
-
Add Binary
easyA step-by-step walkthrough of the Add Binary problem as it unfolds in a real coding interview. Learn the right-to-left pointer technique, carry propagation, and how strong candidates handle unequal-length strings.
-
Valid Anagram
easyHow to solve Valid Anagram (LeetCode #242) in a coding interview. Covers frequency counting vs. sorting, the Unicode follow-up, edge cases, and what strong candidates say to stand out.
-
Valid Palindrome
easyMaster Valid Palindrome for your coding interview. Learn the two-pointer approach, O(1) space optimization, common mistakes, and what interviewers actually evaluate.
-
Longest Palindromic Substring
mediumA step-by-step walkthrough of LeetCode #5 as it plays out in a real coding interview. Learn the expand-around-center technique, why brute force fails at scale, and the odd-vs-even center distinction that trips up most candidates.
-
Longest Substring Without Repeating Characters
mediumA step-by-step walkthrough of LeetCode #3 as it unfolds in a real coding interview. Learn the sliding window approach, the critical index-tracking guard, and how strong candidates communicate their solution.
-
String to Integer (atoi)
mediumA step-by-step walkthrough of the String to Integer (atoi) problem as it unfolds in a real coding interview. Learn to enumerate edge cases upfront, handle overflow clamping, and write a clean single-pass parser.
-
Minimum Window Substring
hardA step-by-step walkthrough of LeetCode #76 as it plays out in a real coding interview. Learn the two-phase sliding window, the formed counter that makes validity O(1), and the frequency map design that handles duplicate characters correctly.
Stacks (6)
-
Implement Queue using Stacks
easyMaster Implement Queue using Stacks for your coding interview. Learn the two-stack inbox/outbox pattern, amortized O(1) reasoning, and what interviewers actually evaluate.
-
Min Stack
easyMaster Min Stack for your coding interview. Learn the auxiliary-state pattern for O(1) getMin, two implementation approaches, and what interviewers actually evaluate.
-
Valid Parentheses
easyA step-by-step guide to solving Valid Parentheses in a coding interview: stack-based reasoning, bracket matching with hash maps, edge cases, and what strong candidates sound like.
-
Evaluate Reverse Polish Notation
mediumMaster Evaluate Reverse Polish Notation for your coding interview. Learn the stack-based evaluation pattern, Python division truncation, and what interviewers actually evaluate.
-
Basic Calculator
hardA step-by-step walkthrough of the Basic Calculator problem as it unfolds in a real coding interview. Learn the stack-save pattern for nested parentheses, sign context management, and how strong candidates trace through expressions.
-
Largest Rectangle in Histogram
hardA step-by-step walkthrough of the Largest Rectangle in Histogram problem as it unfolds in a real coding interview. Learn the monotonic stack approach, the sentinel trick, and how to correctly compute rectangle widths.
Binary Search (4)
-
Binary Search
easyA step-by-step walkthrough of the Binary Search problem as it unfolds in a real coding interview. Learn the precise boundary logic, off-by-one traps, and how strong candidates communicate this deceptively simple algorithm.
-
First Bad Version
easyMaster First Bad Version for your coding interview. Learn the monotonic binary search pattern, overflow-safe midpoint, common off-by-one mistakes, and what interviewers evaluate.
-
Search in Rotated Sorted Array
mediumA step-by-step walkthrough of LeetCode #33 as it plays out in a real coding interview. Learn how to adapt binary search for rotated arrays, nail the boundary conditions, and handle the follow-ups interviewers use to test depth.
-
Time Based Key-Value Store
mediumA step-by-step walkthrough of the Time Based Key-Value Store problem as it unfolds in a real coding interview. Learn the optimal approach using binary search on sorted timestamps, common mistakes, and how strong candidates communicate their solution.
Tries (1)
Backtracking (5)
-
Combination Sum
mediumA step-by-step walkthrough of LeetCode #39 as it plays out in a real coding interview. Learn the backtracking decision tree, the choose/explore/unchoose pattern, and the pruning techniques that separate clean solutions from broken ones.
-
Letter Combinations of a Phone Number
mediumMaster Letter Combinations of a Phone Number for your coding interview. Learn the backtracking Cartesian product pattern, the BFS alternative, and what interviewers actually evaluate.
-
Permutations
mediumA step-by-step walkthrough of LeetCode #46 as it plays out in a real coding interview. Learn the used-array backtracking pattern, why it differs from combination problems, and the swap-based alternative that saves space.
-
Subsets
mediumMaster Subsets for your coding interview. Learn the backtracking snapshot pattern, the recursion tree, and what interviewers actually evaluate.
-
Word Search
mediumMaster Word Search for your coding interview. Learn the grid DFS + backtracking pattern, in-place visited marking, and what interviewers actually evaluate.
No walkthroughs match the selected filter.