Find the City With the Smallest Number of Neighbors at a Threshold Distance
MediumLeetCodeShortest Paths & Topological Sort
Approach hintTry it first, then revealHide
With at most 100 cities, Floyd-Warshall gives every pairwise distance in O(n^3). Count the cities within the threshold for each city and break ties towards the larger index.