Your question is Graph Pathfinding or Traversal. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
An eBay fulfillment service models delivery connections as a directed weighted graph. Each node is a fulfillment location, and each edge contains the travel time between two locations. Given a starting location and a destination, find the minimum travel time and one corresponding route.
Implement minimum_delivery_time(graph, start, destination).
graph is a dictionary mapping a node ID to a list of [neighbor, travel_time] pairs.start and destination are node ID strings present in the graph.[minimum_time, path], where path is a list of node IDs from start to destination.[-1, []].def minimum_delivery_time(graph, start, destination):