Design Parking System LeetCode solution in Python
1# Runtime: 111 ms (Top 92.4%) | Memory: 16.70 MB (Top 96.9%)234class ParkingSystem:5def __init__(self, big: int, medium: int, small: int):6self.vehicle = [big, medium, small]78def addCar(self, carType: int) -> bool:9if carType == 1:10if self.vehicle[0] > 0:11self.vehicle[0] -= 112return True13elif carType == 2:14if self.vehicle[1] > 0:15self.vehicle[1] -= 116return True17elif carType == 3:18if self.vehicle[2] > 0:19self.vehicle[2] -= 120return True21return False