-
1603. Design Parking System javaLeetCode_Study_Plan/Programming Skills 2022. 9. 25. 15:18
https://leetcode.com/problems/design-parking-system/?envType=study-plan&id=programming-skills-i
Design Parking System - LeetCode
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
leetcode.com
class ParkingSystem { int big_room, medium_room, small_room; public ParkingSystem(int big, int medium, int small) { this.big_room = big; this.medium_room = medium; this.small_room = small; } public boolean addCar(int carType) { if (carType == 1){ this.big_room--; if (this.big_room < 0){ return false; } else return true; } if (carType == 2){ this.medium_room--; if (this.medium_room < 0){ return false; } else return true; } if (carType == 3){ this.small_room--; if (this.small_room < 0){ return false; } else return true; } return true; } }
'LeetCode_Study_Plan > Programming Skills' 카테고리의 다른 글
[Programming Skills I] 종료 (2) 2022.09.25 303. Range Sum Query - Immutable java (0) 2022.09.25 1356. Sort Integers by The Number of 1 Bits java (1) 2022.09.24 217. Contains Duplicate java (0) 2022.09.24 242. Valid Anagram java (0) 2022.09.24