All Training Resources

Topic: Data Science.

Difficulty: Easy.

Companies who previously asked this: -

Objective: A bus has 100 labeled seats from 1 to 100. There are 100 people standing in a queue from 1 to 100, and people board the bus in the sequence of 1 to n. The rule is, if a person ‘a’ boards the bus, he checks if seat ‘a’ is empty. If the seat is empty, he sits there, else he randomly picks an empty seat to sit. Given that the first person picks a seat randomly, find the probability that the 100th person sits in his place, i.e. seat number 100.

### Full Solution

The seat of the last person to board will be determined at the moment the first or the last seat is selected.

This is because the last person will either get the first seat or the last seat. Other seats will be occupied by the time the last person gets to select a seat

As each person boards the bus, the probability of the first or last seat being taken is equal. This means that the last person will get either the first or last seat with equal probability.

Therefore, the probability of the last person getting onto seat no. 100 is 1/2.