Search⌘ K
AI Features

Solution: The Number of the Smallest Unoccupied Chair

Solution: The Number of the Smallest Unoccupied Chair tracks friends’ arrival and departure times and asks which smallest-numbered chair the target friend takes.

Statement

At a party, nn friends, numbered from 00 to n−1n - 1, arrive and leave at different times. There are infinitely many chairs, numbered 00 onwards. Each arriving friend sits on the smallest available chair at that moment.

For example, ...