Opening scenario
Network Delay Time (LC 743):
nnodes;times[i] = [u, v, w]is a directed edge with travel timew. A signal starts at nodek. Return the time for all nodes to receive it, or-1if some node can't. Follow-up you should expect: Cheapest Flights Within K Stops (LC 787) — given flights[from, to, price], return the cheapest price fromsrctodstusing at mostkstops, or-1if there is no such route.
LC numbers identify LeetCode problems.
For LC 743, nodes are labeled 1 through n, k is a valid source, and weights are nonnegative. LC 787 labels cities 0 through n-1 and uses nonnegative prices. A stop is an intermediate city: src → a → dst has one stop and two edges. Below, V is the number of vertices and E the number of edges. Compare routes by total weight, then ask whether the edge-count limit changes what you must remember about an arrival.
In the full tutorial
- Question progression
- Canonical Template
- Complexity
- Pattern Recognition Signals
- Practice Set
- Pitfalls
- Variations
- Closing: When to Reach for This