DFS or BFS? How I think about traversing the PathPrep graphs
Quick disclaimer up front: I'm a mid-level engineer, not someone who's been hiring at a FAANG for a decade. I'm not here to tell you the right way to prep. I've just been on both sides of an interview recently enough to have opinions, and PathPrep is the side project where I'm trying those opinions out. People keep asking whether AI tools have made DSA prep pointless, and honestly, I don't think so. AI raised the floor for everyone, but I still want to be the kind of engineer who can reason about a problem before I ask a model, and DSA practice is the cheapest way I've found to keep that muscle alive. So this article is me explaining how I think about the graphs on this site — partly because the structure is opinionated, and partly because if you disagree, that's also fine.
Most prep sites teach patterns. I wanted to go one level deeper.
Every DSA prep site I've used — and I've used most of them — teaches by pattern. Here's sliding window, here's two pointers, here's monotonic stack, here are fifteen problems for each. That's not wrong. Honestly, it's probably how most of the engineers I respect actually got good at this stuff, and I'm not going to pretend it doesn't work. It does.
But the way patterns clicked for me wasn't pattern by pattern — it was pattern with respect to the input type. Two pointers on an array felt like a different mental exercise than two pointers on a linked list, even though the underlying idea is the same. The pattern label said they were the same thing. My head said they were not. So I built PathPrep around the way my head wanted to see it.
If that resonates with you — if you've ever felt like you "know" a pattern but still freeze when the input shape changes — I'd genuinely love it if you poked around the site. I'm not claiming this approach is better than the standard one. I'm claiming it's the one I wish I'd had, and if you're wired the same way, it might click for you too.
The shape of a PathPrep graph
Each technique under each topic — say, two pointers on arrays — is its own little graph. Nodes are problems. Edges connect problems that share the same underlying technique, usually with a small variation: a different invariant, a tweaked window, a new constraint that flips the direction of the pointers. It's not a strict prerequisite tree. It's more like a map of how the technique bends as the input around it changes.
Which means there's no fixed order you're supposed to walk it in. That brings me to the question I get asked the most.
DFS or BFS through the graph?
A friend who's also prepping asked me the other week whether they should go deep on one branch before touching another (DFS) or sweep across all the direct neighbors of the current node first (BFS). I gave them a kind of unsatisfying answer, which is that I don't really know, and I don't think either is wrong.
DFS-style, for me, looks like this: I start at the root, solve it, pick one neighbor, and just keep following that thread. I burn through one variation of the technique until I'm not really thinking about the mechanics anymore, then I come back up and try a different branch. When it works, I feel like I really own that one variation. When it doesn't, I've sunk a couple hours into a thread that didn't teach me as much as I thought it would.
BFS-style is the opposite. Solve the root, then bounce around every neighbor before going deeper. I've done it that way too. The good part is I see a lot of variety fast, so the technique starts feeling familiar across different shapes. The bad part is I sometimes end up half-fluent in everything and not fully fluent in anything.
Both have worked for me at different times. I don't think there's a universal right answer, and anyone who tells you confidently that one is better is probably just describing what worked for them. My honest suggestion: experiment. Pick one, give it a real week, then switch. See which one your brain holds onto better. The graph isn't going anywhere — you can walk it more than once.
Why connected nodes share an input shape
One design choice I should probably explain, since it's not obvious from the outside: when two problems are connected by an edge inside a technique graph, they share an input shape. Two-pointer-on-array problems sit next to other two-pointer-on-array problems. Two-pointer-on-string problems sit in a separate graph, next to other two-pointer-on-string problems. They're not mixed together, even though "two pointer" is technically the same idea in both worlds.
This is the part I want to be careful about, because it's my opinion, and a humble one — I'm not pretending I have data to back this up. The reasoning is just: when I solve a two-pointer problem on an array versus on a string versus on a linked list, the high-level logic is the same, but the actual thought process is nuanced in different ways. On an array of integers my pointers are comparing numeric sums. On a string they're comparing characters or substrings. On a linked list one pointer is jumping by twos and I literally can't look backwards. Same idea, different scenario, and the scenario quietly changes how I think.
My worry with mixing them in one graph was that I'd train myself to skip past that nuance — to assume the technique transfers cleanly when it doesn't always. So I kept the shapes separate. You go deep on two pointers with arrays first, and then later, when you walk the parallel graph for strings, you actually get to feel which instincts carry over and which ones need rewiring. That's the gap I cared most about closing.
Could I be wrong about this? Sure. It's possible that mixing input types in the same graph would help people generalize faster. I just haven't found that to be true for me, and a few people I've talked to feel the same way. If you're one of them, again — please poke around the site and tell me if it lands.
How I'd actually use it
Pick a technique graph. Pick a traversal order — DFS or BFS, your call. Run through it once. Come back a week later, switch the order, run it again. If the second pass feels redundant, your retention is solid. If it feels like a new graph, you just found your blind spots.
That's the whole pitch, really. I don't think this site is a replacement for the other prep tools out there — it's just a different angle on them. If the angle clicks, stick around. If it doesn't, no hard feelings, the pattern-first sites are great too.