class Solution { public int[] solution(int[] num_list, int n) { int[] answer = new int [num_list.length]; int idx = 0; for(int i = n; i < num_list.length; i++) { answer[idx] = num_list[i]; idx++; } for(int i= 0; i < n; i++) { answer[idx] = num_list[i]; if(idx < num_list.length-1) { idx++; } else { return answer; } } return answer; } }
class Solution { public String[] solution(String[] todo_list, boolean[] finished) { // answer length 구하기 int cnt = 0; for(int i = 0; i < finished.length; i++) { if(finished[i] == false) { cnt++; } } String[] answer = new String [cnt]; int idx = 0; for(int i = 0; i < finished.length; i++) { if(finished[i] == false) { answer[idx] = todo_list[i]; idx++; } } return answer; } }
class Solution { public int[] solution(int[] num_list) { for(int i = 0; i num_list[j]) { int tmp = num_list[i]; num_list[i] = num_list[j]; num_list[j] = tmp; } } } int[] answer = new int [num_list.length-5]; System.arraycopy(num_list, 5, answer, 0, answer.length); return answer; } }
class Solution { public int solution(int[] num_list) { int even = 0; // 짝수 int odd = 0; // 홀수 for(int i = 0; i odd) ? even : odd ; } }
class Solution { public int solution(String n_str) { int answer = Integer.parseInt(n_str); return answer; } }