Foundations
Learn the tools before building anything
Every hard problem is built from basic data structures used cleverly. This stage ensures you can implement each structure from scratch in Rust and understand its time complexity intuitively — not from memorization, but from understanding WHY each operation costs what it does.
Solve every problem here in under 15 minutes. If you can’t, the data structure isn’t internalized yet.
📦Arrays & Hashing
The bedrock. ~40% of all interview problems start here. You need to think in terms of ‘what if I precompute this in a HashMap?’ automatically.
HashMap lookup. The most fundamental pattern: trade space for time.
HashSet existence check. Think about why this is O(n) not O(n²).
Frequency counting with a fixed-size array or HashMap.
The leap: using a sorted string as a HashMap KEY. Creative key design is a core skill.
Only start counting from sequence beginnings. Think before you loop.
👆Two Pointers & Sliding Window
The first real ‘pattern’ you’ll learn. It transforms O(n²) brute force into O(n) by exploiting sorted order or monotonic window properties.
Converging pointers from both ends. Simple but builds the muscle memory.
Why does moving the left pointer increase the sum? Understand the proof.
Your first sliding window. When do you shrink vs expand?
The ‘hard’ sliding window — but if you understood #3, this is the same pattern with a counter.
🥞Stack & Queue Fundamentals
Stacks model ‘most recent unresolved thing’ — parentheses, function calls, undo. This thinking leads directly to monotonic stacks later.
The stack’s ‘hello world’. Match most-recent open bracket.
Auxiliary structure trick: maintain a parallel stack of minimums.
Stack as an accumulator. This pattern scales to expression parsing.
Your first monotonic stack! ‘Next greater element’ pattern.
Stack with a physical intuition — cars merge when a faster one catches a slower one.
🔍Binary Search Mastery
Binary search isn’t just ‘find element in sorted array’. It’s a general technique for narrowing a search space. This realization unlocks an entire archetype of hard problems later.
Get the template perfect: lo, hi, mid, and the loop condition. Practice until it’s automatic.
Lower bound. Understand why lo ends up at the insertion point.
Treat the 2D matrix as a flattened sorted array. Index arithmetic.
Binary search on a property, not a value. Which half is sorted?
Binary search on the ANSWER. This is the gateway to a whole class of hards.
🔗Linked Lists
Tests pointer manipulation and edge case thinking. In Rust specifically, linked lists force you to understand ownership, Option<Box<Node>>, and .take() — core interview material for systems roles.
Three pointers: prev, curr, next. Draw it out. Do both iterative and recursive.
Merge step of merge sort. In Rust, practice with Option<Box<ListNode>>.
Floyd’s tortoise and hare. Understand WHY fast catches slow.
Combines three techniques: find middle, reverse second half, merge.
Divide & conquer or min-heap. Your first ‘hard’ that’s just a clean composition of basics.