Assign Locker
Problem Overview
- Determine which locker is assigned to a customer for the last time after N visits.
- Input: N visits; lockers start empty and are numbered from 1; new customers get the lowest available; returning customers release their locker.
- Output: the locker number that is the final assignment event in the sequence.
- Real-world context: an automatic locker system in a changing room.
- This Google interviews coding interview problem is a common interview question.
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Input Variables
Execution Result:
