[Codeforces] Round 920 (Div. 3) E. Eat the ChipRead more
[Codeforces] Round 919 (Div. 2) C. Partitioning the ArrayRead more
[Codeforces] Round 917 (Div. 2) C. Watering an ArrayRead more
[Codeforces] Good Bye 2023 D. Mathematical ProblemRead more
[Codeforces] Round 918 (Div. 4) G. BicyclesRead more
[Codeforces] 2023-2024 ICPC, NERC, Northern Eurasia Onsite (Unrated, Online Mirror, ICPC Rules, Teams Preferred) K. Kim`s QuestRead more
[Codeforces] Round 913 (Div. 3) F. Shift and ReverseRead more
[Codeforces] Round 913 (Div. 3) E. Good TriplesRead more
[Codeforces] 2023-2024 ICPC, Asia Jakarta Regional Contest (Online Mirror, Unrated, ICPC Rules, Teams Preferred) M. Triangle ConstructionRead more
[LeetCode] Find Edges in Shortest Paths

3123. Find Edges in Shortest Paths

You are given an undirected weighted graph of n nodes numbered from 0 to n - 1. The graph consists of m edges represented by a 2D array edges, where edges[i] = [ai, bi, wi] indicates that there is an edge between nodes ai and bi with weight wi.

Consider all the shortest paths from node 0 to node n - 1 in the graph. You need to find a boolean array answer where answer[i] is true if the edge edges[i] is part of at least one shortest path. Otherwise, answer[i] is false.

Return the array answer.

Note that the graph may not be connected.

Read more