Arrays and Hash Map • Beginner • 15 min
Two Sum
How to solve a classic interview problem while explaining the path, the trade-off, and the final choice.
Practice problems with walkthroughs, hints, and solutions.
Filter by type or level
Arrays and Hash Map • Beginner • 15 min
How to solve a classic interview problem while explaining the path, the trade-off, and the final choice.
Arrays and Set • Beginner • 10 min
How to move away from O(n²) by noticing the problem only asks whether you have seen the value before.
Strings and Frequency Count • Beginner • 12 min
How to notice that an anagram is about frequency, not order, and justify the move from sorting to counting.
Strings and Two Pointers • Beginner • 12 min
How to notice that the problem asks for mirrored comparison, not a pile of unnecessary preprocessing.
Stack • Beginner • 15 min
How to notice that each closing bracket must match the most recent opening one and why that calls for a stack.
Arrays and Single Pass • Beginner • 15 min
How to move away from comparing every pair and notice that the problem only needs the lowest price so far.
Arrays and Dynamic Programming • Beginner • 18 min
How to notice that the real question is whether the previous sum still helps or whether it is now hurting.
Search • Beginner • 15 min
How to use sorted order to eliminate half the search space and keep a clear invariant.
Linked List • Beginner • 15 min
How to move away from rebuilding with an array and understand the core pointer idea in a [`linked list`](/glossary/linked-list).
Linked List • Beginner • 18 min
How to notice the lists are already sorted and that the right comparison always happens at the heads.
Dynamic Programming • Beginner • 15 min
How to notice the recurrence from the last two choices and use that as an entry point to dynamic programming.
Sliding Window • Intermediate • 20 min
How to notice that the problem asks for a window that expands and contracts, not a full restart at every repetition.
Arrays and Two Pointers • Intermediate • 25 min
How to reduce a three-variable problem into [two pointers](/glossary/two-pointers) after sorting and handling duplicates in a controlled way.
Arrays and Two Pointers • Intermediate • 18 min
How to justify why only the shorter side makes sense to move and use that to shrink the search.
Hash Map • Intermediate • 18 min
How to notice that the real point is not the map itself, but choosing a canonical key that represents the group.
Arrays and Prefix/Suffix • Intermediate • 20 min
How to use prefix and suffix products to build the local answer for each index from the surrounding context.
Intervals • Intermediate • 20 min
How to sort by start time and turn many intervals into one pass that either expands the current block or opens a new one.
Linked List • Intermediate • 15 min
How to detect a cycle with fast and slow pointers and understand why different speeds eventually meet.
Trees • Beginner • 10 min
How to notice that inverting a tree is just swapping left and right at each node and letting recursion handle the rest.
Trees • Beginner • 10 min
How to measure tree height by thinking about leaves, subtrees, and the combination `1 + max(left, right)`.
Dynamic Programming • Intermediate • 25 min
How to move away from blind combinations and build a DP that searches for the minimum cost for each value up to the target.
Graphs on a Grid • Intermediate • 22 min
How to see each cell as a graph node and use DFS or BFS to consume one whole island at a time.
Trees • Intermediate • 20 min
How to validate a BST by propagating limits through recursion instead of doing local comparisons that look right but break.
Trees • Intermediate • 18 min
How to traverse a tree level by level with a queue and clearly separate what belongs to the current level before moving down.