Coding Test/리트코드 (3) 썸네일형 리스트형 [리트코드/자바] 1603. Design Parking System class ParkingSystem { private int[] emptyArea = new int[3]; public ParkingSystem(int big, int medium, int small) { this.emptyArea[0] = big; this.emptyArea[1] = medium; this.emptyArea[2] = small; } public boolean addCar(int carType) { if (this.emptyArea[carType - 1] != 0) { this.emptyArea[carType - 1] -= 1; return true; } return false; } } [리트코드/자바] 1920. Build Array from Permutation class Solution { public int[] buildArray(int[] nums) { int[] result = new int[nums.length]; for (int n : nums) { result[n] = nums[nums[n]]; } return result; } } [리트코드/자바] 1929. Concatenation of Array class Solution { public int[] getConcatenation(int[] nums) { int[] result = new int[nums.length * 2]; System.arraycopy(nums, 0, result, 0, nums.length); System.arraycopy(nums, 0, result, nums.length, nums.length); return result; } } class Solution { public int[] getConcatenation(int[] nums) { int[] result = new int[nums.length * 2]; for (int i = 0; i < nums.length; i++) { result[i] = nums[i]; re.. 이전 1 다음