Halloween SalePremium questions, over 30% offUnlock all premium questions for over 30% off
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.
...
Asked at:Snapchat
More Snapchat interview questions
- Largest Island Perimetermedium
- Island Statisticsmedium
- Expression Calculatorhard
- Prime Subset Productshard
- Peak Attendance Findermedium
- Parallel Task Batchingmedium
- Org Chart Buildermedium
OfferRetriever
Master technical interviews with real questions from top companies. Build your confidence and career.
LEGAL
© 2026 Purple Business Holdings LLC. All rights reserved. See Terms of Service.