✍스펙업

✍스펙업/코딩테스트

자바 조건에 맞게 수열 변환하기2

class Solution { public int solution(int[] arr) { int answer = 0; int count = 0; int[] beforeArr = new int[arr.length]; while (count != arr.length) { count = calculate(arr, beforeArr, count); answer++; } return answer - 1; } private int calculate(int[] arr, int[] beforeArr, int count) { count = 0; beforeArr = arr.clone(); for (int i = 0; i = 50..

✍스펙업/코딩테스트

자바 리스트 자르기 (Arrays.copyOfRange, ArrayList, List 문법사용)

import java.util.*; class Solution { public int[] solution(int n, int[] slicer, int[] num_list) { int a = slicer[0]; int b = slicer[1]; int c = slicer[2]; if (n == 1) return Arrays.copyOfRange(num_list, 0, b + 1); if (n == 2) return Arrays.copyOfRange(num_list, a, num_list.length); if (n == 3) return Arrays.copyOfRange(num_list, a, b + 1); if (n == 4) { List result = new ArrayList(); for (int i ..

우동한그릇
'✍스펙업' 카테고리의 글 목록 (8 Page)