
import java.util.*;
import java.util.stream.Collectors;
class Solution {
public String solution(String s) {
String answer = "";
List<Integer> nums = Arrays.stream(s.split(" "))
.map(Integer::parseInt)
.collect(Collectors.toList());
Integer max = Collections.max(nums);
Integer min = Collections.min(nums);
return min + " " + max;
}
}
import java.util.*;
class Solution {
public String solution(String s) {
String[] str = s.split(" ");
List<Integer> nums = new ArrayList<>();
for (int i = 0; i < str.length; i ++) {
nums.add(Integer.parseInt(str[i]));
}
Integer max = Collections.max(nums);
Integer min = Collections.min(nums);
return min + " " + max;
}
}
stream 이용

for문 이용
