Design a parking system for a parking lot that has three kinds of spaces: big, medium, and small, with a fixed number of slots of each kind.
- The system is initialized with the number of `big`, `medium`, and `small` slots.
- `addCar(carType)` checks whether there is a free slot for the given car type. `carType` is `1` (big), `2` (medium), or `3` (small). A car can only park in a slot of its own type. Returns `true` if a slot was available (and parks the car, decrementing that slot count), or `false` if no slot of that type is free.
Implement the function `parkingSystem(big, medium, small, operations)` where the first three arguments are the initial slot counts and `operations` is a list of `[op, ...args]`: `["addCar", carType]`. Return the list of results, one per operation (use null for operations that return nothing - though every operation here returns a boolean).
Example 1
Input:big = 1, medium = 1, small = 0, operations = [["addCar",1],["addCar",2],["addCar",3],["addCar",1]]
Output:[true, true, false, false]
Example 2
Input:big = 2, medium = 0, small = 0, operations = [["addCar",1],["addCar",1],["addCar",1]]
Output:[true, true, false]
Example 3
Input:big = 0, medium = 0, small = 0, operations = [["addCar",1],["addCar",2],["addCar",3]]
Output:[false, false, false]
Constraints
0 <= big, medium, small <= 1000. carType is 1, 2, or 3. At most 1000 operations.