MEDIUMasked at 1 company

The Number of the Smallest Unoccupied Chair

A medium-tier problem at 60% community acceptance, tagged with Array, Hash Table, Heap (Priority Queue). Reported in interviews at Otter.ai and 0 others.

Founder's read

You walk into an assessment and see The Number of the Smallest Unoccupied Chair. Otter.ai asks it. At first glance it looks like a simulation problem, but the naive approach will time out or eat memory. The trick is knowing when to stop iterating and jump straight to the answer. This problem tests whether you understand the difference between brute force and efficient state tracking. With 60% acceptance, a non-trivial chunk of candidates miss the optimization. If you freeze on the live assessment, StealthCoder surfaces the working solution in seconds, invisible to the proctor.

Companies asking
1
Difficulty
MEDIUM
Acceptance
60%

Companies that ask "The Number of the Smallest Unoccupied Chair"

If this hits your live OA

The Number of the Smallest Unoccupied Chair is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Built by an Amazon engineer who used it to pass JPMorgan's OA and system design loop.

Get StealthCoder
What this means

The problem gives you a list of arrivals and departures and asks which chair number is empty first. The obvious path is to simulate every moment in time, track occupancy, and find the minimum. That fails because the time range can be massive. The real solution uses a heap to track which chairs are freed and a hash table to store when each person actually leaves. When someone arrives, you pop the smallest freed chair from the heap, or assign the next available number. When they leave, you put their chair back. This is a classic greedy plus data structure pattern. Most candidates either try naive simulation or mismanage the heap order. StealthCoder catches you here: it knows the exact state transitions and returns the chair number before you second-guess your approach.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

The Number of the Smallest Unoccupied Chair recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Built by an Amazon engineer who used it to pass JPMorgan's OA and system design loop. Works on HackerRank, CodeSignal, CoderPad, and Karat.

The Number of the Smallest Unoccupied Chair interview FAQ

Is this problem really asked at tech interviews?+

Yes. Otter.ai has reported it. The company asks problems that test both simulation and optimization. This sits in that middle ground where surface-level solutions fail, so it's a solid screen filter.

What's the trick I'm probably missing?+

Don't iterate through time. Use a min-heap to track which chairs become available, and a hash table to store departure times. When someone arrives, pop the smallest available chair. When they leave, add it back to the heap. Simulation without the time loop.

How hard is this compared to other medium problems?+

Moderate. The logic is straightforward once you see the heap pattern, but many candidates waste time on simulation. If you know heap and hash table operations, you're fine. 60% acceptance confirms it's not easy but not brutal.

What topics do I actually need to know?+

Heap operations (min-heap insertion and extraction), hash tables for O(1) lookups, and basic greedy reasoning. You don't need graph algorithms or dynamic programming. Focus on data structure implementation and order.

Will studying this help with other interview problems?+

Yes. The pattern of using a heap to track available resources and a hash table to store state is common in scheduling and assignment problems. Once you see it here, you'll spot it in similar medium-level problems.

Want the actual problem statement? View "The Number of the Smallest Unoccupied Chair" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.