Beakjoon&프로그래머스/Java
[프로그래머스/Java] 제일 작은 수 제거하기
현장
2025. 2. 24. 15:57
-Code
import java.util.*;
import java.util.stream.Collectors;
class Solution {
public int[] solution(int[] arr) {
List<Integer> arr_list = Arrays.stream(arr).boxed()
.collect(Collectors.toList());
arr_list.remove(Collections.min(arr_list));
if (arr_list.isEmpty()) arr_list.add(-1);
return arr_list.stream().mapToInt(Integer::intValue).toArray();
}
}