Form 5v5 Matches From a Ranked Queue With Widening Rating Windows
Last updated: November 29, 2026
Quick Overview
Given players waiting in a ranked queue with a rating and an enqueue time, form as many 5v5 matches as possible where every player is within a rating tolerance of the longest-waiting anchor, with tolerance growing with wait time; split each match into two balanced teams.
Riot Games
November 29, 20260
0
0 solved
Given players waiting in a ranked queue with a rating and an enqueue time, form as many 5v5 matches as possible where every player is within a rating tolerance of the longest-waiting anchor, with tolerance growing with wait time; split each match into two balanced teams.
An onsite coding round shaped around matchmaking for League of Legends and VALORANT ranked queues. The interviewer wants a clear policy (who gets priority, how the window grows), a correct greedy implementation, and a reasoned team split, then probes the quality versus queue-time trade-off.
What the Interviewer Expects
- State the matching policy explicitly before coding
- Prioritize the longest-waiting players
- Grow tolerance with wait time and cap it
- Pick the closest-rated candidates inside the window
- Balance teams with a snake draft or similar and justify it
- Discuss complexity and how to make it faster
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
- How do you handle premade parties of different sizes in the same queue?
- How would you add role preferences (top, jungle, mid, bot, support) to the constraint?
- What metrics tell you the widening rate is too aggressive?
- How would you make this faster than quadratic for a queue of 100k players?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Inputs: (player_id, rating, enqueue_time), the current time, a base tolerance, a widening rate per second and a cap. A match needs 10 players all within the anchor's tolerance, where the anchor is t...
High-Level Design
Iterate anchors from oldest to newest. For each anchor compute tol = min(cap, base + rate * wait), collect unmatched players within rating +/- tol, and if at least 10 exist, take the 10 closest to...