city_count cities numbered from 0 to city_count - 1. Each roads[i] = [a, b] is a two-way road between cities a and b; any two cities are joined by at most one road.
The load of a pair of different cities is the number of roads that touch at least one of them. A road that runs directly between the two is counted once.
Return the largest load over all pairs of cities.city_count=5, roads=[[0, 1], [0, 2], [0, 3], [3, 4]] → 4
City 0 has 3 roads and city 3 has 2, one of which (0–3) they share. Together that is 3 + 2 − 1 = 4.
city_count=6, roads=[[0, 1], [0, 2], [3, 4], [3, 5]] → 4
The cities need not be connected: 0 and 3 have two roads each and share none, so 4.
city_count=3, roads=[] → 0
city_count=5, roads=[[0, 1], [0, 2], [0, 3], [3, 4]]
4
Run checks the first 3 tests in your browser. Submit checks all 42 tests on the server, hidden ones included.