This is a verified interview question from Uber. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Uber – Roads on Fastest Delivery Routes - Uber Online Assessment IIT BHU Data Science Role" covers key patterns like Arrays.
"Uber operates a road network connecting n cities, numbered from 0 to n − 1. The road network is represented as an undirected weighted graph, where each road has an associated travel time. For planning premium deliveries, Uber wants to identify all roads that belong to at least one shortest route from the main distribution center (city 0) to the destination hub (city n − 1). Given the road network, determine for every road whether it appears in any shortest path from city 0 to city n - 1. Return a boolean array where the i-th value is: true if the i-th road belongs to at least one shortest path. false otherwise. Function Description Complete the function findFastestRouteEdges. ``` vector<bool> findFastestRouteEdges( int n, vector<vector<int>> roads ); ``` Parameters n — Number of cities. roads[i] = [u, v, w] — An undirected road connecting cities u and v with travel time w. Returns vector<bool> — A boolean array where the i-th value indicates whether the i-th road is part of at least one shortest path from city 0 to city n - 1."
Join thousands of developers practicing for Uber.