Intermediatecoding Verified
Given timestamped friendship logs between n people, find the earliest time when everyone is connected (Earliest Moment When Everyone Become Friends).
ReportedSource: GeeksforGeeks interview experience: Uber SDE-1 off-campus
Quick answerFree
Sort logs by time; Union-Find with a component counter; return the timestamp when the count first hits 1, else -1. O(m log m).
Detailed answer· 90 words
Interview PrepUnlock the full answer with Interview Prep
Get a 90-word model answer and a runnable reference solution, plus 61 more DSA questions.
Also in Pro (₹499 / 90 days).
Reference solution· runs in the browser sandbox
Interview PrepUnlock with Interview Prep
+ 61 more DSA questions in Interview Prep, each with the full answer.