Search
⌘K

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:

Google

Google


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Late September, 2024

Google

Google

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

Google

Google

Mid-level

The Earliest Moment When Everyone Become Friends

Comments

Your account is free and you can post anonymously if you choose.