Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Added 1603 - design parking system Python solution
  • Loading branch information
TassaraR committed Aug 5, 2023
commit 9075ad82961a2ae5e7a940af07b0341be4eb1721
17 changes: 17 additions & 0 deletions python/1603-design-parking-system.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class ParkingSystem:

def __init__(self, big: int, medium: int, small: int):

# [total_occupied, max_capacity]
self.parking = {
1: [0 ,big],
2: [0, medium],
3: [0, small]
}

def addCar(self, carType: int) -> bool:
new_total = self.parking[carType][0] + 1
if new_total <= self.parking[carType][1]:
self.parking[carType][0] += 1
return True
return False