Back to problems

Checking Your Route

Algorithm · Weride · Hard

A ride-hailing platform operates across multiple cities. To prevent delays, drivers need to know which roads truly belong to the fastest possible route from a starting city to a destination. You are given a connected, undirected graph representing cities (nodes) and bidirectional roads (edges), each with a non-negative travel length. Your task: identify every edge that lies on at least one shortest path from node 1 to node g_nodes. Return an array of strings, one string per…

Checking your access…