Uber跳槽电面

Q.
There are city_nodes cities numbered from 1 to city_nodes.
The cities are connected by bidirectional edges to form a connected graph.
The weight is the distance between the connected cities.
distanceThreshold is the minimum desired distance from any other city. Determine the city with the smallest number of neighboring cities that are nearer that the distanceThreshold. If there are multiple answers, choose the higher city number.

Example
distanceThreshold = 3
city_nodes = 3
city_from = [1,2]
city_to = [2,3]
city_weight = [3,1]

Answer: city number 3