leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

1603.cpp (288B)


      1 class ParkingSystem {
      2     vector<int> space;
      3 
      4   public:
      5     ParkingSystem(int big, int medium, int small) : space(vector<int>{0, big, medium, small}) {}
      6 
      7     bool addCar(int carType) {
      8         if (space[carType] == 0) return false;
      9         space[carType]--;
     10         return true;
     11     }
     12 };