AMDOCS OA 2024 | Find the City With the Smallest Number of Reachable Cities | Floyd Warshall
Question · Posted Jun 2026
Problem Statement There are n cities connected by weighted edges. Given: n edges[i] = [from, to, weight] distanceThreshold Find the city with the smallest number of cities reachable within the threshold distance. If multiple cities have the same count, return the city with the greatest index. Example Input n = 4 edges = [[0,1,3], [1,2,1], [1,3,4], [2,3,1]] distanceThreshold = 4 Output 3
The full answer & interview discussion are available to premium members.
Log in Create a free account