Given a network of n nodes and weighted edges [u,v,w], find how long it takes for a signal from node k to reach all nodes. This is Dijkstra's algorithm — shortest path from a single source.
Answer = max of all shortest distances. If any node unreachable, return -1.
💡 Pro tip: Understand this problem deeply — don't just memorize the code. Try explaining the approach out loud as if teaching a friend. If you can explain it simply, you truly understand it!
networkDelayTime(times, 4, 2)
2