Design Parking System LeetCode solution in Java
1class ParkingSystem {2private int slots[] = new int[3];34public ParkingSystem(int big, int medium, int small) {5slots[0] = big;6slots[1] = medium;7slots[2] = small;8}910public boolean addCar(int carType) {11if (slots[carType - 1] > 0) {12slots[carType - 1]--;13return true;14}15return false;16}17}