[programmers] 최댓값과 최솟값

https://school.programmers.co.kr/learn/courses/30/lessons/12939

import java.util.*;

class Solution {
    public String solution(String s) {
        String answer = "";
        String[] arr = s.split(" ");

        Arrays.sort(arr, (o1,o2) -> {
            return Integer.parseInt(o1) - Integer.parseInt(o2);
        });

        return arr[0] + " " + arr[arr.length-1];
    }
}

© 2023 Lee. All rights reserved.