High-Card Pot Game
Reported by candidates from Affirm's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
The High-Card Pot Game reported at Affirm in September 2026 looks like a card-game story, but it's just a deck sliced into chunks of size players. Deal order means round r is simply deck[r*players] through deck[r*players + players - 1]. Each chunk, find the max, check if it's unique, and either hand over the running pot or let it grow. It's a plain simulation, linear time, no tricks. If you've got the OA invite and 48 hours, this one is a warm-up that punishes sloppy edge cases. StealthCoder sits invisibly on your screen during the live assessment as a safety net if you blank on the chunking logic.
The problem
Deal the given deck to players players in round-robin order, starting with player 0. Each player's cards remain in deal order. During a round, every player who still has a card reveals their next card and all revealed cards enter a shared pot. If exactly one player revealed the highest rank, that player wins every card currently in the pot and the pot becomes empty. If the highest rank is tied, the pot carries into the next round. A pot that remains after all hands are exhausted is unclaimed. Return the number of cards won by each player. Function highCardPotScores(deck: int[], players: int) → int[] Examples Example 1 deck = [5,3,2,7] players = 2 return = [2,2] Player 0 wins the first two cards; player 1 wins the second round. Example 2 deck = [8,8,2,9,1,3] players = 3 return = [6,0,0] The first-round high rank is tied, so all six cards are in the pot when player 0 uniquely reveals 9. Example 3 deck = [4,4] players = 2 return = [0,0] The only round ties, so the final pot is unresolved and unclaimed. Constraints 2 <= players <= 52. 0 <= deck.length <= 100000. Each card rank is in [1, 13]; higher numbers beat lower numbers.
Reported by candidates. Source: FastPrep
Pattern and pitfall
The trick is noticing you never need to build per-player hands. Round-robin dealing means the cards revealed in round r are one contiguous slice of the deck, and the index within the slice is the player id. Walk the deck in steps of players. Keep a pot counter. For each slice, track the max rank, how many times it appears, and the index of the first holder. Add the slice length to the pot. If the max count is exactly one, add the pot to that player's score and reset it to zero. Otherwise carry on. The pitfalls are the final partial slice, where fewer players reveal, and forgetting that a tie at the very end leaves the pot unclaimed. Empty deck returns all zeros. If your head locks up mid-OA, StealthCoder can hand you the loop as a hedge, but the logic is short enough to own.
The honest play: practice the pattern, and have StealthCoder ready for the one you didn't see coming.
You can drill High-Card Pot Game cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play.
Get StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass Affirm's OA.
Affirm reuses patterns across OAs. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play. Works on HackerRank, CodeSignal, CoderPad, and Karat.
High-Card Pot Game FAQ
How hard is the High-Card Pot Game really?+
Easy. It's a single pass over the deck with a few counters. The difficulty is reading the statement carefully, not the algorithm. Most misses come from the partial last round or mishandling ties. If you can write a loop with a max and a count, you can solve it.
What's the trick to the Affirm High-Card Pot Game?+
Skip building hands. Dealing round-robin means each round is a contiguous slice of length players, and the offset inside the slice is the player id. Process slice by slice, keep a running pot, and award it only when the max rank appears exactly once in that slice.
How do I handle ties and the unclaimed pot?+
On a tie for the highest rank, don't reset the pot. Just keep adding the next slice's cards to it. When someone finally wins uniquely, they take everything. If the deck ends with the pot nonzero, ignore it. Nobody gets those cards, as in the [4,4] example.
What edge cases should I test before submitting?+
Test an empty deck, which returns all zeros. Test a deck shorter than players, so only some players reveal in a single partial round. Test a deck length not divisible by players. Test a tie in the final round. Also test all cards equal, where nobody ever wins.
What's the complexity, and is it fast enough for 100000 cards?+
It's O(n) time and O(players) space for the output array. With a deck of 100000 cards and at most 52 players, one pass is trivial. Don't sort or build per-player lists. That adds memory and work you don't need.