Question bank › Union Find
Dsa Union Find Easy

Online Gaming Clans

In an online gaming platform, players can form clans based on their interactions. Given a list of pairs of players who have interacted, determine how many distinct clans exist. Two players are in the same clan if there is any direct or indirect interaction between them. Write a function that processes the input relationships and outputs the number of distinct clans. Input format: - The first line contains an integer K, the number of interactions. - The following K lines each contain two integers P1 and P2, representing an interaction between player P1 and player P2. Output format: - A single integer representing the number of distinct clans. Example: Input: 3 1 2 2 3 4 5 Output: 2

Key concepts

union_findclan_managementsocial_network

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of Praxari's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.