Where to stand in the birthday line
A theatre offers a free ticket to the first person in the queue whose birthday is the same as that of someone standing ahead of them. You may choose where to stand, and everyone's birthday is independent and uniform over 365 days.
Which position in the queue maximises your chance of winning the ticket? Explain the trade-off.
Show a hint
To win at position n you need two things: the n minus 1 people ahead of you must all have different birthdays (otherwise someone ahead of you has already won), and your birthday must match one of theirs. Write the product and see where it peaks.
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
💡 Discussion rules
- No full solutions here. Hints and approaches only.
- Complexity, edge cases and intuition are the point.
- Interview experiences are welcome. Respect your NDAs.
Loading discussion…
Learn the concepts
The theory behind this question.