There are n people numbered from n logs where each element logs[i] timestamp_i$, x_i and person y_i at the given timestamp_i.
Friendship is symmetric and transitive. This means that if person
Return the earliest timestamp at which every person in the group becomes friends with everyone else. If it is impossible for all n people to become connected, return
Constraints:
n
logs.length
logs[i].length
timestamp_i
x_i, y_i n
x_i y_i
All values of timestamp_i are unique.
All pairs (x_i, y_i) occur at most once in the input.
There are n people numbered from n logs where each element logs[i] timestamp_i$, x_i and person y_i at the given timestamp_i.
Friendship is symmetric and transitive. This means that if person
Return the earliest timestamp at which every person in the group becomes friends with everyone else. If it is impossible for all n people to become connected, return
Constraints:
n
logs.length
logs[i].length
timestamp_i
x_i, y_i n
x_i y_i
All values of timestamp_i are unique.
All pairs (x_i, y_i) occur at most once in the input.