LeetCode
The Earliest Moment When Everyone Become Friends
Click
here
for an explanation.