</>OfferRetriever
DashboardDiscuss
NEW

Summer Sale

Limited Time Deal: Unlock all premium questions for over 30% off

$10.42$7.08

14

:

03

:

43

:

05

Get this deal
Back to Dashboard

Unfriended Pairs Counter

Medium
FREE

In a social network of n people labeled 0 to n - 1, friendship is mutual and transitive through direct connections. People belong to the same friend group (connected component) when a chain of direct friendships links them.

Given a list of direct connections (pairs [a, b]), count the number of unordered pairs (i, j) where 0 <= i < j < n such that i and j are not in the same friend group. ...

OfferRetriever

Master technical interviews with real questions from top companies. Build your confidence and career.

PRODUCT
PricingDashboardDiscussOfferRetriever vs LeetCode
LEGAL
POPULAR COMPANIES
GoogleMetaAmazonMicrosoftNetflixStripeUberTikTokBrowse all companies →

© 2026 Purple Business Holdings LLC. All rights reserved. See Terms of Service.