📜 WAYPOINT LESSON
Checkpoint — The Order Is the Algorithm
⭐⭐⭐ advanced⏳ 25 min read📍 Lesson 227 of 281
Longest path in a DAG at full scale: Kahn order + one sweep. The W adds the reverse edge — the directed/undirected stumble — and reports inflated paths.
Checkpoint — The Order Is the Algorithm. Longest path needs every predecessor processed first: Kahn's topological order + a linear DP sweep, O(n + m), no recursion (depth would hit 200000). The W is the directed/undirected stumble: it quietly adds the reverse edge, turning a directional structure into a symmetric one — plausible-looking code, wrong on any asymmetric graph, and it even risks double-counting in the indegree logic.