Counting Poker Hands
How to count five-card poker hands using combinations rather than listing them out, worked through for pairs and flushes — the standard warm-up combinatorics question in quant interviews.
"How many ways can you deal a five-card poker hand?" sounds like it wants you to start listing hands. It doesn't — with 2,598,960 possible five-card hands from a 52-card deck, listing is impossible, and the interviewer knows it. What they want is whether you reach for combinations, , instead of trying to enumerate anything by hand. This is the standard warm-up for a longer line of questions ("how many are a flush," "how many are two pair") that build on the same technique.
The tool: choosing without order
A five-card hand is a set of cards — the order you're dealt them doesn't matter, and no card repeats. That's exactly what counts: the number of ways to choose items from without regard to order. The total number of five-card hands from a 52-card deck is
In plain English: there are about 2.6 million distinct five-card hands, and every poker probability question is really "how many of those 2.6 million hands have property , divided by 2,598,960."
Worked example 1: counting flushes
A flush is five cards of the same suit (ignoring straight flushes for now, and yes, real poker excludes straight flushes from "flush" — a good interview move is to name that ambiguity and pick a convention). Pick the suit: 4 ways. Given a suit, pick 5 of its 13 cards: ways. So the count of same-suit hands is
The probability of any five-card hand being a flush (including straight flushes) is — about 1 in 505 hands. This is the general pattern: break the hand into independent choices (suit, then ranks within that suit), count each choice with a combination, and multiply.
Worked example 2: counting one pair
"Exactly one pair" (two cards of one rank, three cards of three different other ranks, no further coincidences) needs more care because you must avoid double-counting and avoid accidentally including three-of-a-kind or two-pair hands. Break it into steps: choose the paired rank, ways; choose 2 of the 4 suits for that rank, ways; choose the 3 other (distinct) ranks from the remaining 12, ways; choose 1 suit out of 4 for each of those 3 cards independently, ways. Multiply:
That's about of all hands — one pair is by far the most common non-trivial hand, which matches poker intuition. The technique — decompose into a sequence of independent choose-steps, multiply the counts, and only then divide by the total — generalizes to every "count hands with property " question you'll be asked.
Poker hand-counting is always the same recipe: decompose the hand into a sequence of independent selection steps (which ranks, which suits), count each step with or a simple product, multiply the steps together, then divide by for the probability. Never try to enumerate hands directly.
The most common error is double-counting or under-counting because a decomposition accidentally treats two different selection orders as different outcomes, or forgets that "exactly one pair" must exclude ranks that would create a second pair or a three-of-a-kind. Before multiplying, sanity-check by asking whether your decomposition could produce the same final hand through two different paths — if so, you're overcounting.
Related concepts
Practice in interviews
Further reading
- Ross, A First Course in Probability, ch. 1