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

Решение

class ParkingSystem(big: Int, medium: Int, small: Int) {

		private val capacity = intArrayOf(big, medium, small)

    fun addCar(carType: Int): Boolean {
        val idx = carType - 1
        return if (capacity[idx] > 0) {
            capacity[idx]--
            true
        } else false
    }
}

/**
 * Your ParkingSystem object will be instantiated and called as such:
 * var obj = ParkingSystem(big, medium, small)
 * var param_1 = obj.addCar(carType)
 */