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, andsmallslots. addCar(carType)checks whether there is a free slot for the given car type.carTypeis1(big),2(medium), or3(small). A car can only park in a slot of its own type. Returnstrueif a slot was available (and parks the car, decrementing that slot count), orfalseif 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).