Graph Valid Tree: A Step-by-Step Interview Walkthrough
Graph Valid Tree looks like a quick traversal problem and turns out to be a test of whether you actually know what a tree is. Most candidates can run a DFS, but this problem rewards understanding the structural definition of a tree — connected and acyclic — and recognizing that those two conditions, combined with the right invariant, collapse into a surprisingly clean check. The signal here is whether you can reason about graph properties rather than just running an algorithm
7 hours ago12 min read
Alien Dictionary: A Step-by-Step Interview Walkthrough
Alien Dictionary is one of the hardest "medium" problems in the interview rotation, and it earns that reputation by hiding a clean graph problem behind a deceptive premise. The instinct is to think about sorting or string comparison — but those are dead ends. The real insight is that the sorted order of the words is a set of ordering constraints between letters, and recovering the alphabet means assembling those constraints into a consistent sequence: a topological sort.
13 hours ago13 min read
Reconstruct Itinerary: A Step-by-Step Interview Walkthrough
Reconstruct Itinerary is a problem that looks like a routine graph traversal and turns out to be a subtle trap for the obvious approach. The setup practically begs for backtracking. That works, but it's exponential, and the candidates who reach for it spend their time wrestling with backtracking bookkeeping instead of seeing the structure. The candidates who recognize "use every edge exactly once" as the definition of an Eulerian path unlock a clean, near-linear algorithm.
15 hours ago12 min read
Network Delay Time: A Step-by-Step Interview Walkthrough
Network Delay Time is the problem interviewers use to find out whether you understand why Dijkstra's algorithm exists, not just how to type it out. The candidates who understand that unequal edge weights invalidate BFS's core assumption know to reach for Dijkstra instead. The signal here is whether you can tell weighted shortest path from unweighted shortest path, and whether you know why the distinction forces a different algorithm.
1 day ago13 min read
Minimum Height Trees: A Step-by-Step Interview Walkthrough
Minimum Height Trees is a problem that punishes the obvious approach and rewards stepping back to find structure. The naive reading — "try every node as the root, measure the height, keep the best" — works, but it's quadratic, and the interviewer is specifically watching to see whether you settle for that or push for the insight that makes it linear. The key realization is that this isn't really a "measure heights" problem at all; it's a "find the center of the tree" problem
3 days ago13 min read
