Escape Room / Room-by-Room Race
Asked at Pinterest · Coding Questions · Difficulty: Medium · Last asked Apr 19, 2026
Design a small game-state data structure: `n` rooms and `m` players all start in room 0; each call advances one player to the next room. Support O(1) per-room headcount, O(1) per-player move, and a top-K leaderboard where farther rooms rank higher and arrival-order breaks ties within the same room. By far the most-recurring custom Pinterest coding prompt in the current rotation, asked at both phone and onsite.
Loading the problem…