Design Parking System LeetCode solution in JavaScript

1
var ParkingSystem = function (big, medium, small) {
2
this.count = [big, medium, small];
3
};
4

5
/**
6
* @param {number} carType
7
* @return {boolean}
8
*/
9
ParkingSystem.prototype.addCar = function (carType) {
10
return this.count[carType - 1]-- > 0;
11
};
12

13
/**
14
* Your ParkingSystem object will be instantiated and called as such:
15
* var obj = new ParkingSystem(big, medium, small)
16
* var param_1 = obj.addCar(carType)
17
*/

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0