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.
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)`.