arr return
[4,3,2,1] [4,3,2]
[10] [-1]
class Solution {
public int[] solution(int[] arr) {
if (arr.length==1) {
int[] answer_one = {-1};
return answer_one;
}
int[] answer = new int[arr.length-1];
int min = arr[0];
for (int i=0; i<arr.length; i++){
min = Math.min(min, arr[i]); // 함수 추가한 부분
}
int answer_num = 0;
for (int j=0; j< arr.length; j++){
if (arr[j]==min){
continue;
}
answer[answer_num++] = arr[j];
}
return answer;
}
}