https://leetcode.com/problems/design-parking-system/description/
class ParkingSystem: def __init__(self, big: int, medium: int, small: int): self.count = [big, medium, small] def addCar(self, carType: int) -> bool: self.count[carType - 1] -= 1 return self.count[carType - 1] >= 0
时间复杂度:O(1) 空间复杂度:O(1)
Last updated 9 months ago