
728x90
import java.util.*;
class Solution {
public String solution(String s) {
String answer = "";
List<String> split = new ArrayList<>(List.of(s.split(" ")));
List<Integer> integers = new ArrayList<>();
for (String s1: split){
int number = Integer.parseInt(s1);
integers.add(number);
}
Collections.sort(integers);
answer+= integers.get(0);
answer+= " ";
answer+= integers.get(integers.size()-1);
return answer;
}
}
728x90
반응형
'알고리즘' 카테고리의 다른 글
하샤드수(Lv.1)[프로그래머스] (0) | 2022.09.27 |
---|---|
최댓값과 최솟값(Lv.2)[프로그래머스] (0) | 2022.09.26 |
[1차]캐시 2018 KAKAO BLIND RECRUITMENT(Lv.2)[프로그래머스] (0) | 2022.09.22 |
야근지수(Lv.3)[프로그래머스] (2) | 2022.09.21 |
이중우선순위큐(Lv.3)[프로그래머스] (0) | 2022.09.20 |