#3123

Find Edges in Shortest Paths

candidate master · 1525 · lc hard +32 · 46.4% accepted · 309 likes · top 31%

Description

An undirected weighted graph has n nodes (0 to n - 1) with edges edges[i] = [ai, bi, wi]. Return a boolean array answer where answer[i] is true if edge i lies on at least one shortest path from node 0 to node n - 1, and false otherwise. The graph may be disconnected.

Code

1
2
3