Search
⌘K

Leetcode 1942. The Number of the Smallest Unoccupied Chair

Simulate friends arriving in chronological order and always assign each arrival the smallest-numbered free chair. Use a min-heap of available chair indices and a min-heap keyed by leave times to free chairs as time advances, and return the chair assigned to targetFriend.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.