Skip to content

Commit 0cc7ed4

Browse files
authored
Create 1603-design-parking-system.kt
1 parent 6c2dd14 commit 0cc7ed4

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

kotlin/1603-design-parking-system.kt

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class ParkingSystem(big: Int, medium: Int, small: Int) {
2+
3+
val spaces = intArrayOf(big, medium, small)
4+
5+
fun addCar(carType: Int): Boolean {
6+
if (spaces[carType - 1] > 0) {
7+
spaces[carType - 1]--
8+
return true
9+
}
10+
return false
11+
}
12+
13+
}

0 commit comments

Comments
 (0)