Problem #38 EASY

The Sock Drawer

Amazon Microsoft Pigeonhole Logic

Problem Statement

A student's bedroom is completely dark and she is in a hurry. Her drawer contains 10 red socks and 10 blue socks, all mixed together. She cannot see any colours. What is the minimum number of socks she must pull out of the drawer to guarantee that she has at least one matching pair — two socks of the same colour?

Answer & Quick Explanation

Think you've got it? Click below to check your answer.

She must pull out exactly 3 socks. With only 2 colours, the worst case after 2 pulls is one of each. The third pull must match one of them. The total number of socks in the drawer does not matter.

Detailed Editorial Solution

Want to see the step-by-step breakdown? Click below to reveal the editorial.

This is a direct application of the Pigeonhole Principle: if you distribute more items than there are categories, at least one category must contain more than one item. Here the categories are colours (just 2) and the items are socks. Step 1: There are only 2 possible sock colours: red and blue. Think of these as 2 pigeonholes. Step 2: Worst-case scenario on pull 1: she gets a red sock. Worst case on pull 2: she gets a blue sock. After 2 pulls, she has one of each colour — no pair yet. Step 3: Pull 3: no matter what colour comes out, it must be either red or blue. Either way, it matches one of the two socks already in her hand. Step 4: So after exactly 3 pulls, she is guaranteed at least one matching pair — regardless of what order the socks come out. Step 5: The number of socks in the drawer (10 red + 10 blue = 20) is completely irrelevant to the answer. Only the number of distinct colours matters. Step 6: General rule: to guarantee a matching pair from k colours, you need k + 1 draws. Key Insight: The Pigeonhole Principle turns a question about probability into a question about logic. Once you reframe it as 'how many categories exist?' rather than 'what are the odds?', the answer becomes immediate. The total number of socks is a red herring.