Description
Design a parking system for a parking lot with big, medium, and small spots. Implement ParkingSystem(big, medium, small) and addCar(carType) that returns true if a spot is available.
Examples
Input:
big = 1, medium = 1, small = 0, calls = [[1],[2],[3],[1]]Output:
[true,true,false,false]Explanation:
Parking operations.
Input:
big = 1, medium = 1, small = 0, calls = [[1]]Output:
[1]Explanation:
A single parking operation on a lot with 1 big and 1 medium spot.
Input:
big = 2, medium = 0, small = 3, calls = [[3],[1],[3],[2],[1],[3]]Output:
[true,true,true,false,true,true]Explanation:
Initially: 2 big spots, 0 medium spots, 3 small spots. First small car parks (spots: 2,0,2). Big car parks (spots: 1,0,2). Second small car parks (spots: 1,0,1). Medium car fails - no medium spots available. Third big car parks (spots: 0,0,1). Fourth small car parks (spots: 0,0,0). Shows how different car types use their designated spots independently.
Constraints
- •
0 ≤ big, medium, small ≤ 1000