Merge Party Invites Under a Voice Chat Size Cap

Last updated: November 29, 2026

Quick Overview

n players each start in a solo party; process a list of accepted invites (a, b) in order, merging their two parties unless the merged size would exceed a cap, and report for each invite whether it merged, was rejected, or the players were already together.

PlayStation
Coding & Algorithms
Software Engineer
PlayStation
November 29, 2026
Software Engineer
Technical Screen
Coding & Algorithms
Medium

0

0

0 solved


n players each start in a solo party; process a list of accepted invites (a, b) in order, merging their two parties unless the merged size would exceed a cap, and report for each invite whether it merged, was rejected, or the players were already together.

PS5 parties combine voice chat, Share Play, and game sessions and have a hard member cap, so merging groups under a capacity limit is a direct analogue. The interviewer is checking whether you recognize union-find, track component sizes, and handle the already-connected case.

What the Interviewer Expects
  • Recognize disjoint set union with size tracking
  • Check the cap before merging and leave state unchanged on rejection
  • Detect already-same-party invites
  • Use path compression and union by size
  • Discuss why leaving a party breaks plain union-find
Key Topics to Cover
Union-find
Path compression
Union by size
Graph connectivity
Parties
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • Players can leave a party; what data structure would you use now?
  • How would you return the full member list of a player's party quickly?
  • What if the cap depends on the party type (voice only versus Share Play)?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Players are 0..n-1. Each invite (a, b) tries to join a's party and b's party. Outcomes: merged, rejected (would exceed cap), or already (same party). State must not change on a rejection....

High-Level Design

Disjoint set union where each root stores its party size. For an invite, find both roots. Same root means already together. Otherwise, if size[ra] + size[rb] > cap reject, else attach the smaller tr...


Submit Your Answer
Markdown supported

Related Questions