← Questions

Shortest path, nodes on any shortest path, and can Alice evade Bob

0
GoogleCodingLast asked Sep 2026

You get an undirected, unweighted graph with n nodes. Alice starts at node a and wants to reach node t.

  1. Return the length of the shortest path from a to t.
  2. Return every node that lies on at least one shortest path from a to t.
  3. Bob is also on the graph and tries to catch Alice. Decide whether Alice can reach t without Bob getting to her first.
Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding