You are given an integer n representing the number of cities, labeled from n roads where each roads[i] a_i, b_i a_i and city b_i.
The network rank of two distinct cities is the total number of directly connected roads to either city. If a road directly connects both cities, it is counted only once.
The maximal network rank is the maximum network rank across all pairs of distinct cities.
Return the maximal network rank of the infrastructure.
Constraints:
n
roads.length
roads[i].length
a_i, b_i n
a_i b_i
Each pair of cities has at most one road connecting them.
You are given an integer n representing the number of cities, labeled from n roads where each roads[i] a_i, b_i a_i and city b_i.
The network rank of two distinct cities is the total number of directly connected roads to either city. If a road directly connects both cities, it is counted only once.
The maximal network rank is the maximum network rank across all pairs of distinct cities.
Return the maximal network rank of the infrastructure.
Constraints:
n
roads.length
roads[i].length
a_i, b_i n
a_i b_i
Each pair of cities has at most one road connecting them.