
Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Find all the shortest paths starting from nodes 0 and <code>n - 1</code> to all other nodes.
How to use the above calculated shortest paths to check if an edge is part of at least one shortest path from 0 to <code>n - 1</code>?