You are given n computers labeled from connections, where each element connections[i] = [a_i, b_i] represents a cable directly connecting computers a_i and b_i.
A cable can be removed from its current pair of computers and reconnected between any two computers.
Return the minimum number of such cable move operations needed to make all n computers part of a single connected network. If it is impossible to connect all computers, return
Constraints:
n
connections.length
connections[i].length
a_i, b_i n
a_i b_i
There are no repeated connections.
No two computers are connected by more than one cable.
You are given n computers labeled from connections, where each element connections[i] = [a_i, b_i] represents a cable directly connecting computers a_i and b_i.
A cable can be removed from its current pair of computers and reconnected between any two computers.
Return the minimum number of such cable move operations needed to make all n computers part of a single connected network. If it is impossible to connect all computers, return
Constraints:
n
connections.length
connections[i].length
a_i, b_i n
a_i b_i
There are no repeated connections.
No two computers are connected by more than one cable.