Design Parking System
Easy
Topics
Design a parking system for a lot with three kinds of spaces: big, medium, and small, with a fixed number of each. Implement ParkingSystem(big, medium, small) and addCar(carType) where carType is 1 (big), 2 (medium), or 3 (small). Return true if there is an available slot of that type (and park the car), otherwise false.
Example 1
Input: operations = ["ParkingSystem","addCar","addCar","addCar","addCar"], values = [[1,1,0],[1],[2],[3],[1]] Output: [null,true,true,false,false]
Constraints
- 0 <= big, medium, small <= 1000
- carType is 1, 2, or 3.
- At most 1000 calls to addCar.
Run ⌘' · Submit ⌘⏎