adj to store the adjacency list of each city.roads array and update the adjacency list for both cities involved in the road.maxRank to keep track of the maximum network rank found.(city1, city2).
city1 and city2.city1 and city2 are directly connected, subtract 1 from the sum to avoid double-counting.maxRank if the current network rank is greater than the previously recorded maximum.maxRank as the result.