Amazon Interview Question

Finding the shortest path in a route