Skip to content

Suggestion for the 'old friend' airplane question #3

@jjpn97

Description

@jjpn97

Hi,

Just want to thank you for creating this doc, certainly helped for my interviews! Thought I should give back by suggesting a slightly easier solution for the airplane question (I think yours has a bit too much going on).

Define p_n = probability of last person in their seat if there are n people. Either the first person goes to their seat (with prob 1/n) and everything's fine, or the first person goes to any seat other than the last, in which case we return to the same problem with n-1 people.

So p_n = 1/n + (n-2)/n p_(n-1). Since p_2 = 1/2 it is simple to use induction to prove p_n = 1/2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions