Reported September 2026
OpenAIsimulation

Poker Deal and Hand-Winner Simulation

Reported by candidates from OpenAI's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live OpenAI OA. Under 2s to a working solution.
Founder's read

The OpenAI OA reported in September 2026 looks like a card game, but it's a classification problem wearing a costume. Up to 10 players and 50 cards means brute force is never the issue. Messy hand ranking is. You deal round-robin, build an event log, then score each five-card hand and find every tied winner. If you've got the OA in a day or two, the risk is a missed edge case, not the runtime. StealthCoder is the safety net if you blank mid-assessment, but the plan below should get you most of the way.

The problem

Simulate one five-card poker deal. You are given the players in fixed turn order as userIds and all cards in chronological deal order as dealtCards. Card dealtCards[i] is dealt to player userIds[i % userIds.length].
Each card is a two-character code. Its first character is one of 2 through 9, T, J, Q, K, or A. Its second character is one of C, D, H, or S.
After every player has five cards, compare the hands using standard five-card poker order, from strongest to weakest:
straight flush
four of a kind
full house
flush
straight
three of a kind
two pair
one pair
high card
Within a category, compare the deciding ranks from highest to lowest. An ace is normally high, but A-2-3-4-5 is a five-high straight. Suits never break ties.
Return the complete chronological event log:
For each dealt card, append DEAL userId card.
After evaluating all hands, append WINNERS ids, where ids is every tied winner in ascending lexicographic order, joined by commas.

Function
simulatePoker(userIds: String[], dealtCards: String[]) → String[]

Examples
Example 1
userIds = ["alice","bob"]
dealtCards = ["AS","9C","KS","9D","QS","2H","JS","2C","TS","7S"]
return = ["DEAL alice AS","DEAL bob 9C","DEAL alice KS","DEAL bob 9D","DEAL alice QS","DEAL bob 2H","DEAL alice JS","DEAL bob 2C","DEAL alice TS","DEAL bob 7S","WINNERS alice"]
Alice has an ace-high straight flush. Bob has two pair, so Alice is the only winner.
Example 2
userIds = ["a","b"]
dealtCards = ["AS","AH","KD","KC","QH","QS","JC","JD","9S","9C"]
return = ["DEAL a AS","DEAL b AH","DEAL a KD","DEAL b KC","DEAL a QH","DEAL b QS","DEAL a JC","DEAL b JD","DEAL a 9S","DEAL b 9C","WINNERS a,b"]
Both players have the same ace-high hand by rank. Suits do not break ties, so both identifiers are returned.

Constraints
2 <= userIds.length <= 10
Every user identifier is unique and contains only lowercase letters and digits.
dealtCards.length = 5 * userIds.length.
Every card is a valid two-character code, and no card appears more than once.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is turning each hand into a comparable key. Count ranks, then sort rank groups by count descending, then rank descending. That tuple gives your tiebreakers for free: four of a kind, full house, pairs and trips all fall out of the group shape. Put the category number first, then the sorted ranks, and compare tuples directly. Pitfalls: the wheel straight A-2-3-4-5 must be treated as five-high, so the ace counts as 1 there. Straight flush is just flush plus straight. Suits never break ties, so don't include them in the key. Ties must return every winner sorted lexicographically, joined by commas. Deal order uses index mod player count, and the DEAL lines come before WINNERS. If you freeze during the live OA, StealthCoder can supply the hand-evaluator while you check these edge cases.

Memorize the pattern. If you can't, run StealthCoder. The proctor sees the IDE. They don't see what's behind it.

If this hits your live OA

You can drill Poker Deal and Hand-Winner Simulation 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. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass OpenAI's OA.

OpenAI reuses patterns across OAs. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Poker Deal and Hand-Winner Simulation FAQ

How hard is the OpenAI poker simulation really?+

Medium on difficulty, high on detail. There's no clever algorithm, just careful hand classification. Inputs are tiny, so performance doesn't matter. Most failures come from the wheel straight, wrong tiebreak order, or forgetting that tied winners all get listed.

What's the trick to ranking the hands?+

Build a key tuple per hand: category rank, then ranks ordered by group count descending and card value descending. Python and JavaScript can compare these directly. Full house, two pair and trips then need no special tiebreak code at all.

How do I handle the A-2-3-4-5 straight?+

Check for five distinct ranks. If the max minus min is 4, it's a straight. Otherwise, if the ranks are exactly {14,5,4,3,2}, treat it as a straight with high card 5. Use 5 as the deciding rank so it loses to a 6-high straight.

How should I output tied winners?+

Collect every player whose key equals the max key. Sort their userIds lexicographically with a plain string sort, join with commas, and prefix with WINNERS. Example 2 shows this: both players tie, so it prints WINNERS a,b.

How do I prepare for this in 48 hours?+

Write the evaluator from scratch once. Test five hands: straight flush, wheel straight, full house, two pair versus two pair with a kicker, and a full tie. Then check the deal loop with index mod player count. That covers nearly every trap here.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with OpenAI.

OA at OpenAI?
Invisible during screen share
Get it