1603. Design Parking System

https://leetcode.com/problems/design-parking-system/description/

solution

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