Find the timestamp at which all users become connected, given a connection log.
Unlock detailed company stats for this questionUpgrade
Logs have the form <timestamp> <UserA> shared ride with <UserB> and are sorted by timestamp. Each log connects UserA and UserB at that timestamp. Determine the earliest timestamp at which all users in the system are connected.
Expect follow-ups like
- Find the timestamp after which the maximum number of connections between any two nodes is at most k (fixed), and all users are connected.
- Logs can now also include 'timestamp, userB unfriends userC' - find the timestamp when all users are connected.
- Logs can also contain '<timestamp> <UserA> cancel ride with <UserB>', which removes the connection - now find the earliest timestamp at which all users are connected.
Format · Uber SDE I elimination round, Feb 2026.
Also asked as · Find the earliest timestamp at which all users become connected.
Community answers
No answers contributed by the community yet.
Related questions
Given a chronological log of riders sharing rides, return the earliest timestamp when all riders are connected.Compute the connection distance between two users given each user's connections.Find when all entities become connected in a graph whose relationships evolve over time.Related courses

Course

Course
Course

