Probability
The probability questions and answers in this lesson will help you understand the types of probability questions you can expect in data science interviews.
One hundred people line up to board an airplane. Each has a boarding pass with an assigned seat. However, the first person to board the plane lost their boarding pass and took a random seat. After that, each person takes the assigned seat if it is unoccupied and one of the unoccupied seats at random otherwise. What is the probability that the last person to board gets to sit in their assigned seat?
This problem will be easily solved if you focus on the seat assigned to the first person and the seat assigned to the last person. The first person might sit in the last person's seat or their own. That means we have only two seats available for the last person—their seat and the seat of the first person. Therefore, the probability that the last person will sit in their seat is the total number of seats assigned to them divided by the number of seats they can sit in is calculated as follows:
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.