Quick Overview

Given an unsorted log of timestamped friend and unfriend events among n people, return the earliest time at which everyone is connected through chains of friendships, or -1 if that never happens. It tests connectivity reasoning when edges can be both added and removed, event ordering, and careful handling of groups that split apart again.

Earliest Time a Friendship Network Is Fully Connected with Friend and Unfriend Events

Company: Google

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

Overview: Given an unsorted log of timestamped friend and unfriend events among n people, return the earliest time at which everyone is connected through chains of friendships, or -1 if that never happens. It tests connectivity reasoning when edges can be both added and removed, event ordering, and careful handling of groups that split apart again.

Loading…