viewers seats, and exactly viewers tickets were sold, each for its own seat. Viewers walk in one at a time in ticket order.
The first viewer has lost their ticket and sits in a random seat, all seats being equally likely. Everyone after that takes their own seat if it is free; if it is taken, they pick a random one among the seats still free.
Return the probability that the last viewer ends up in their own seat.viewers=1 → 1
One viewer and one seat: they cannot miss their own.
viewers=2 → 0.5
The first viewer picks their own seat (then the second gets theirs) or the other one (then the second ends up in the first viewer's seat) with equal chance, so 0.5.
viewers=4 → 0.5
viewers=1
1
Run checks the first 3 tests in your browser. Submit checks all 29 tests on the server, hidden ones included.