End of Year Sale: Use Coupon Code END2025 to Get Extra 25% Off.
times array, where each entry adj[source] contains a list of pairs (time, dest) representing the travel time and destination node for each edge.signalReceivedAt with a large value for all nodes to represent infinity.signalReceivedAt[k] to 0 since the signal starts from node k.(0, k) to the priority queue, where 0 is the current shortest distance to k.currNode with the smallest distance currDist from the queue.
b. If currDist is greater than signalReceivedAt[currNode], skip to the next iteration.
c. For each (time, neighborNode) in adj[currNode], if currDist + time is less than signalReceivedAt[neighborNode], update signalReceivedAt[neighborNode] and add (currDist + time, neighborNode) to the queue.signalReceivedAt. If it's still the initial large value for any node, return -1. Otherwise, return the maximum value.