FastPrepTexas Hold'em Winners
Problems/Texas Hold'em Winners

Texas Hold'em Winners

Airbnb logoAirbnb● MediumINTERNPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Airbnb software engineer intern technical round in Beijing in 2021. The report only names the task as Texas poker. It was one of two coding rounds, said to be at a medium to hard level.

The report gives no rules, interface, limits or examples. Here, each player makes the best five-card hand from five shared cards and their own two cards, hands follow the usual poker order with an ace allowed as the low card of a straight, suits never break ties, and you return every player who ties for the best hand. The card format, limits and examples are our own.

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

In Texas Hold'em, five shared cards lie face up on the table, called the board. Each player also holds two private cards, given in hands. A player's hand is the best five-card hand they can make from their seven cards: the five board cards plus their own two.

Each card is a string of two characters: its rank, then its suit. The ranks from low to high are 2 to 9, T (ten), J, Q, K and A. The suits are C, D, H and S.

Five-card hands rank from strongest to weakest:

  1. Straight flush: five cards of the same suit with ranks in a row.
  2. Four of a kind: four cards of one rank.
  3. Full house: three cards of one rank and two of another.
  4. Flush: five cards of the same suit.
  5. Straight: five cards with ranks in a row.
  6. Three of a kind: three cards of one rank.
  7. Two pair: two cards of one rank and two of another.
  8. One pair: two cards of one rank.
  9. High card: none of the above.

An ace can be the top of a straight (T J Q K A) or the bottom (A 2 3 4 5). A 2 3 4 5 is the lowest straight, with 5 as its top card. A straight cannot wrap around, so Q K A 2 3 is not a straight.

Two hands of the same kind are compared by rank only. Suits never break a tie.

  • Straight flush or straight: the higher top card wins.
  • Four of a kind, full house, three of a kind, two pair or one pair: first compare the ranks of the groups, the bigger group first and, for two pair, the higher pair first. Then compare the other cards from highest to lowest.
  • Flush or high card: compare the five cards from highest to lowest.

If everything is equal, the hands tie.

Return the indexes of all players with the best hand, in increasing order. More than one player wins when they tie.

Function

findWinners(board: String[], hands: String[][]) → int[]

Examples

Example 1

board = ["KS","7D","7C","2H","9S"]hands = [["KH","3D"],["AH","AS"],["7S","QC"]]return = [2]
board
010KS17D27C32H49S

Player 0 can make two pair, kings and sevens, with a nine: KS KH 7D 7C 9S.

Player 1 can make two pair, aces and sevens, with a king: AH AS 7D 7C KS. This beats player 0 because aces are higher than kings.

Player 2 has a third seven, so they can make three of a kind: 7D 7C 7S KS QC. Three of a kind beats two pair, so only player 2 wins.

Example 2

board = ["5S","6D","7H","8C","9S"]hands = [["2D","2H"],["KC","QD"],["4H","3C"]]return = [0,1,2]
board
0105S16D27H38C49S

The board is already a straight from 5 to 9, so every player has at least that straight.

Player 0's pair of twos and player 1's king and queen do not help. Player 2 can make 3 4 5 6 7 and 4 5 6 7 8, but both are lower than the board's straight, which tops out at 9.

All three players have the same best hand, so they tie and the answer is [0,1,2].

Example 3

board = ["AH","2D","3H","4C","9H"]hands = [["5S","KD"],["KH","7H"],["5H","6H"]]return = [1]
board
010AH12D23H34C49H

Player 0 can make the lowest straight, A 2 3 4 5, where the ace counts as low.

Player 1 has five hearts: AH KH 9H 7H 3H. That is a flush, which beats a straight.

Player 2 also has five hearts: AH 9H 6H 5H 3H. That is a flush too. They can also make the straight 2 3 4 5 6, but the flush is better. It is not a straight flush, because 2D and 4C are not hearts.

Both flushes start with an ace. The second-highest cards are a king for player 1 and a nine for player 2, so player 1 wins.

Constraints

  • board.length == 5
  • 2 <= hands.length <= 10
  • hands[i].length == 2
  • Every card has length 2: a rank from "23456789TJQKA" followed by a suit from "CDHS".
  • All cards in board and hands are different.

More Airbnb Phone Screen questions

  • Read Across Sound TracksPHONE SCREEN · Seen Nov 2026
  • Text JustificationPHONE SCREEN · Seen Nov 2026
  • Decode and Store StringsPHONE SCREEN · Seen Oct 2026
  • Print Sentences as TablePHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
  • Detonate Bombs with Chain ReactionsPHONE SCREEN · Seen Aug 2026
  • Smallest Common RegionPHONE SCREEN · Seen Aug 2026
  • Longest Chain BookingPHONE SCREEN · Seen Aug 2026
  • Nested List Iterator with RemovePHONE SCREEN · Seen Jul 2026
  • Parse Query StringPHONE SCREEN · Seen May 2026
  • Pacific Atlantic Water FlowPHONE SCREEN · Seen May 2023

Similar questions at other companies

  • 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
  • Message Event AggregationOpenAI · PHONE SCREEN · ONSITE INTERVIEWOpenAI interview questions
  • Shopping Cart ReceiptSony Interactive Entertainment PlayStation · PHONE SCREEN
  • Banking System with Pending Transfer AcceptanceCircle · PHONE SCREENCircle interview questions
  • Server Log Summary and Minute AnomaliesNinjaTrader · PHONE SCREEN
  • Streaming Top-K Frequent ElementsNVIDIA · PHONE SCREENNVIDIA interview questions
  • Interview Slot BookingTrueFoundry · PHONE SCREEN

Interview reports that mention this question

  • Airbnb Intern Phone Interviews: 21 Experiences (Part 7 of 7)

Airbnb interview experiences

  • Airbnb SWE OA: Four-Level Banking System: 1 Experience
  • Airbnb Campus and Full-Time SWE OA / Interviews: 9 Experiences
  • Airbnb Intern OA and Phone Screens: 17 Experiences (Part 6 of 7)
  • Airbnb Intern OA and Onsite Rounds: 16 Experiences (Part 5 of 7)
  • Airbnb Intern OA, Diplomacy Game: 19 Experiences (Part 4 of 7)
All Airbnb interview questionsSee Airbnb hiring insights
Saved
class Solution {
    public int[] findWinners(String[] board, String[][] hands) {
      // Write your code here.
    }
}
Checking account…