Random queue: how many taller-behind-shorter pairs?
Five people, all of different heights, line up in a completely random order from front to back. Consider every pair of people: the pair is "misordered" if the taller person is standing somewhere behind the shorter one.
On average, how many misordered pairs are there in the line of 5?
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
Sign in to join the discussion · reading is open to everyone
💡 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.
Related questions
How many rising steps in a shuffled list?How many falling steps in a shuffled list?Coats handed back at random: how many match?Secret Santa draws: how many pick themselves?Quizzes returned at random: how many honor students?
All questions →