Qm

How many socks to guarantee two pairs?

A drawer contains a large number of black socks and a large number of white socks, all jumbled. It is dark and you cannot tell them apart.

The classic question asks how many socks you must pull out to guarantee one matching pair (the answer is three).

How many must you pull out to guarantee two matching pairs? The pairs may be the same colour or different colours: two black pairs, two white pairs, or one of each all count. Then generalise to k pairs.

Show a hint

Think about the worst possible sequence of colours. With four socks, can you be unlucky?

Your answer

Solving needs a free account

Answers, streaks and solutions unlock when you are signed in. Reading the question and the hint stays free.

Discussion

Sign in to join the discussion · reading is open to everyone

💡 Discussion rules

  1. No full solutions here. Hints and approaches only.
  2. Complexity, edge cases and intuition are the point.
  3. Interview experiences are welcome. Respect your NDAs.

Loading discussion…

Learn the concepts

The theory behind this question.

Related questions

Gloves in the darkMatching socks in the darkA run of days that nets a multiple of nFifty-one ants and a small square cardTen two-digit numbers and two equal sums
All questions →