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

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.

Google logo
Google
Sep 12, 2026
mediumSoftware EngineerOnsiteCoding & Algorithms
Loading...