FastPrepPoker Deal and Hand-Winner Simulation
Problems/Poker Deal and Hand-Winner Simulation

Poker Deal and Hand-Winner Simulation

OpenAI logoOpenAI● HardFULLTIMENEW GRADPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an OpenAI phone screen for full-time and new grad roles. The report leaves out the deck, the hand-ranking, the tie, and the log formats. Here we use a conventional five-card simulation that covers the reported deal, comparison, and logging.

Our version is about 82% the same as the reported question.

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:

  1. straight flush
  2. four of a kind
  3. full house
  4. flush
  5. straight
  6. three of a kind
  7. two pair
  8. one pair
  9. 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.

More OpenAI Phone Screen questions

  • Prefix Matrix Products and AutogradPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Streaming Entropy, Part 1: Batch EntropyPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Streaming Entropy, Part 2: Numerically Stable EntropyPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Streaming Entropy, Part 3: Block-wise EntropyPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Streaming Entropy, Part 4: Stable Streaming EntropyPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Rectangle Point Coverage CountsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Secret Number Search with One-Call-Delayed FeedbackPHONE SCREEN · Seen Nov 2026
  • Determine the Winner of Three-Card HandsPHONE SCREEN · Seen Nov 2026
  • Grid Infection with Recovery After D DaysPHONE SCREEN · Seen Nov 2026
  • Sparse Plant Infection SimulationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Document Enrichment Stream AggregatorBloomberg LP · PHONE SCREENBloomberg LP interview questions
  • Popular and Instant-Runoff Election WinnersCoursera · PHONE SCREEN
  • In-Memory Database with TTL and Historical QueriesZip · PHONE SCREENZip interview questions
  • Config Store with Priority OverridesMicrosoft · PHONE SCREENMicrosoft interview questions
  • In-Memory Filesystem CommandsPerplexity AI · PHONE SCREEN · ONSITE INTERVIEWPerplexity AI interview questions
  • Merchant Payout Scheduler, Part 2: Per-Merchant SchedulesStripe · PHONE SCREENStripe interview questions
  • Pins Violation Log QueriesPinterest · PHONE SCREENPinterest interview questions
  • Camel CardsRippling · PHONE SCREEN · ONSITE INTERVIEWRippling interview questions
  • Shopping Cart ReceiptSony Interactive Entertainment PlayStation · PHONE SCREEN
  • Banking System with Pending Transfer AcceptanceCircle · PHONE SCREENCircle interview questions

OpenAI interview experiences

  • OpenAI OA: What It Tests (2026)
All OpenAI interview questionsSee OpenAI hiring insights
Saved
class Solution {
    public String[] simulatePoker(String[] userIds, String[] dealtCards) {
        // Write your code here.
    }
}
Checking account…