내 답안
class Solution {
public int[] solution(int[] num_list, int n) {
int[] answer = new int[n];
for(int i = 0; i < n; i++){
answer[i] = num_list[i];
}
return answer;
}
}
Java
복사
다른사람 풀이
import java.util.*;
class Solution {
public int[] solution(int[] num_list, int n) {
int[] answer = {};
answer = Arrays.copyOfRange(num_list,0,n);
return answer;
}
}
Java
복사
import java.util.Arrays;
class Solution {
public int[] solution(int[] num_list, int n) {
return Arrays.copyOfRange(num_list, 0, n);
}
}
Java
복사