warming up your workspace

How to actually learn data structures and algorithms

Most people learn data structures and algorithms the hard way: they open a problem site, sort by "most solved," and start grinding. A month later they can recite that a hash map is O(1) but they freeze on anything they have not seen before. The grind teaches recognition of specific problems, not the underlying skill.

Here is an approach that actually builds the skill, in three phases.

Phase 1: Build the foundations from scratch

Before you use a structure, build it once. Implement a dynamic array, a hash map, a stack, a queue, and a linked list yourself. It takes an afternoon each and it changes how you think.

When you have written the resize logic of a dynamic array, "append is amortized O(1)" stops being a fact you memorized and becomes something you understand. When you have handled collisions in a hash map, you know exactly why a bad hash degrades it to O(n). This understanding is what lets you reason about a brand new problem instead of pattern-matching to one you have seen.

Cover arrays and hashing, then strings, stacks, and queues. Aim for clarity, not speed.

Phase 2: Learn the patterns, not the problems

The middle phase is where recognition is built. Work through binary search and its variants, trees and their traversals, recursion, sorting, and the windowing patterns. Group problems by pattern rather than by topic: do five sliding-window problems in a row, then five two-pointer problems, until the tell for each is automatic.

The goal of this phase is that when you read a new question, your first thought is "this is a monotonic stack problem," not "I have never seen this."

Phase 3: The hard patterns

The final phase is the one people skip and then get caught on: graphs (BFS, DFS, union-find, shortest paths), backtracking, and dynamic programming. These reward deliberate practice more than volume. Understand the backtracking skeleton once and N-queens, subsets, and combinations all fall out of it. Understand overlapping subproblems once and the whole DP family opens up.

A few rules that make it stick

  • Quality over volume. A focused set of around one hundred problems that covers every pattern beats a thousand random ones. Interviews test structured thinking and clear explanation, not how many problems you have seen.
  • Write code, do not just read solutions. You only find out whether you understand something when you run it and it fails.
  • Get feedback immediately. A long edit-run-debug loop is where motivation dies. The faster you see whether a solution passes, the more you learn per hour.
  • Space your reviews. Re-solve a problem a few days later, then a week later. Spaced repetition is the difference between "I solved it once" and "I can solve it under pressure."

Where to do it

This is the exact arc the Interview Prep track is built on: ten projects that take you from arrays and hashing through dynamic programming, where you build each structure from scratch and then apply it, with every solution graded in your browser the moment you run it. The first project is free.

Start at the foundations and work the patterns in order. That is the whole secret.