본문 바로가기
Beakjoon&프로그래머스/Java

[프로그래머스/Java] 최댓값과 최솟값

by 현장 2025. 2. 27.

-Code

import java.util.*;
import java.util.stream.Collectors;

class Solution {
    public String solution(String s) {
        List<Integer> list = Arrays.stream(s.split(" "))
                            .mapToInt(Integer::parseInt)
                            .boxed()
                            .collect(Collectors.toList());

        return Collections.min(list) + " " + Collections.max(list);
    }
}