Leetcode 1101. The Earliest Moment When Everyone Become Friends
Given timestamped friendship events among N people, determine the earliest time when the social graph becomes fully connected; process events in chronological order and use a union-find (DSU) to merge components, returning the timestamp when the component count becomes one or -1 if it never does.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Mid August, 2026
Similar question to LC 990 was asked in SDE II. A computer network is made up of N different nodes. The network experienced an outage, and now none of the nodes can communicate with any other nodes. The network is starting to recover and you have a log that contains pairs of nodes that communicate with each other and the timestamp that it occurred. Find the earliest time where the network recovered from the outage. The network fully recovers when all nodes can reach all the other nodes, either directly or indirectly. Example Input: N = 4 log = [[0, 1, 1], [1, 2, 5], [1, 3, 7], [0, 2, 8]] 0 -- 1 / | / | / | 2 3 Input Explanation: 1. Node 0 and 1 started communicating at timestamp 1 2. Node 1 and 2 started communicating at timestamp 5 3. Node 1 and 3 started communicating at timestamp 7 4. Node 0 and 2 started communicating at timestamp 8 Example Output: 7 Output Explanation: The network recovered at timestamp 7
Late March, 2026
We have a log of Uber rides when passengers shared their rides together through Uber share. The log is sorted chronologically: * 1670000001 Alice shared-ride-with Bob * 1670000042 Charlie shared-ride-with Dan * 1670000450 Bob shared-ride-with Charlie * 1670000501 Alice shared-ride-with Eve * 1670000621 Bob shared-ride-with Dan Given this log text and a list of all possible riders, write a function that returns the earliest timestamp when all riders become connected through the car shared network. A rider is connected to another if they have shared a ride, or if they are connected through a chain of other riders
Mid March, 2026
During BPS round (phone screen)
Hello Interview Premium
Your account is free and you can post anonymously if you choose.