← 返回 google 的题目列表Signal Propagation in Graph
类型:online_judge
Given a weighted graph, find the shortest time for a signal to propagate from a given starting node to all other nodes. Return the maximum of all the shortest path times, or -1 if any node is unreachable.
Example
Input
[(2, 1, 1), (2, 3, 1), (3, 4, 1)], 4, 2
Output
2