Skip to content

Commit 9075ad8

Browse files
committed
Added 1603 - design parking system Python solution
1 parent 1d42bc1 commit 9075ad8

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Diff for: python/1603-design-parking-system.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class ParkingSystem:
2+
3+
def __init__(self, big: int, medium: int, small: int):
4+
5+
# [total_occupied, max_capacity]
6+
self.parking = {
7+
1: [0 ,big],
8+
2: [0, medium],
9+
3: [0, small]
10+
}
11+
12+
def addCar(self, carType: int) -> bool:
13+
new_total = self.parking[carType][0] + 1
14+
if new_total <= self.parking[carType][1]:
15+
self.parking[carType][0] += 1
16+
return True
17+
return False

0 commit comments

Comments
 (0)