Posted on

Description

Submission

class ParkingSystem {
    vector<int> park;
public:
    ParkingSystem(int big, int medium, int small) {
        park = {big, medium, small};
    }
    
    bool addCar(int carType) {
        carType -= 1;
        if(!park[carType]) return false;
        park[carType]--;
        return true;
    }
};

/**
 * Your ParkingSystem object will be instantiated and called as such:
 * ParkingSystem* obj = new ParkingSystem(big, medium, small);
 * bool param_1 = obj->addCar(carType);
 */

Leave a Reply

Your email address will not be published. Required fields are marked *