Shortest Path and Nodes on Any Shortest Path

Given an undirected, unweighted graph with nodes 0..n-1, a source s, and a target t:

  1. Find the shortest distance from s to t.
  2. Return every node that can occur on at least one shortest ...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: