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.
Asked at:
Uber
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Late March, 2026
Uber
Senior
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
Late September, 2024
Mid-level
Find the earliest timestamp when all become friends with add and remove friend operations. Two types of logs: Add Friend (A and B become friends) and Remove Friend (If A and B are friends, unfriend them). Two people can be connected and disconnected multiple times.
Late September, 2024
Mid-level
The Earliest Moment When Everyone Become Friends
Hello Interview Premium
Your account is free and you can post anonymously if you choose.