Group Players Wearing Identical Avatar Accessory Sets
Last updated: November 29, 2026
Quick Overview
Given a list of players and the accessory item IDs each has equipped (possibly with duplicates and in any order), return groups of player IDs whose equipped sets are identical. Only return groups with at least two players.
Roblox
November 29, 20260
0
0 solved
Given a list of players and the accessory item IDs each has equipped (possibly with duplicates and in any order), return groups of player IDs whose equipped sets are identical. Only return groups with at least two players.
A warm-up in the style of a Roblox phone screen, framed around the Avatar Shop and the catalog of equipped accessories. The interviewer checks that you pick a canonical hashable key, handle duplicates and ordering, and talk through complexity without prompting.
What the Interviewer Expects
- Normalize each item list into an order-independent, duplicate-free key
- Use a hash map from key to player list
- State time and space complexity correctly
- Handle empty outfits and single-player groups explicitly
- Write clean, readable code quickly
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- What changes if duplicates matter (a player wearing two of the same item counts differently)?
- How would you do this across 200 million players stored in a sharded table?
- Could you use a hash of the sorted set instead of the tuple, and what is the collision risk?
- How would you find pairs of outfits that differ by exactly one item?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Input is (player_id, items) pairs. Two players match if their sets of equipped items are equal, so [3,1,2] and [2,3,1] match and [1] matches [1,1]. Output only groups of size two or more. I ...
High-Level Design
The core idea is a canonical key: convert each list to a set to drop duplicates, then sort it so order does not matter, and use the resulting tuple as a dictionary key. Every player with the same key ...