We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5142c72 commit 1f748aaCopy full SHA for 1f748aa
1603-design-parking-system.js
@@ -0,0 +1,29 @@
1
+/**
2
+ * @param {number} big
3
+ * @param {number} medium
4
+ * @param {number} small
5
+ */
6
+const ParkingSystem = function(big, medium, small) {
7
+ this['3'] = small
8
+ this['2'] = medium
9
+ this['1'] = big
10
+};
11
+
12
13
+ * @param {number} carType
14
+ * @return {boolean}
15
16
+ParkingSystem.prototype.addCar = function(carType) {
17
+ this[carType]--
18
+ if(this[carType] < 0) {
19
+ this[carType] = 0
20
+ return false
21
+ }
22
+ return true
23
24
25
26
+ * Your ParkingSystem object will be instantiated and called as such:
27
+ * var obj = new ParkingSystem(big, medium, small)
28
+ * var param_1 = obj.addCar(carType)
29
0 commit comments