The Earliest Moment When Everyone Become Friends

There are n people labeled 0 to n-1. You are given m logs [timestamp, x, y] meaning x and y become friends at time timestamp. Friendship is symmetric and transitive. Return the earliest time at whic...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: