๋ฌธ์
https://school.programmers.co.kr/learn/courses/30/lessons/12939?language=java
ํ์ด
class Solution {
public String solution(String s) {
String answer = "";
String[] numbers = s.split(" ");
int min = Integer.MAX_VALUE;
int max = Integer.MIN_VALUE;
for(int i = 0; i < numbers.length; i++){
int number = Integer.parseInt(numbers[i]);
min = Math.min(min, number);
max = Math.max(max, number);
}
answer = min+ " " +max;
return answer;
}
}
'๐๏ธ Algorithm > โฌ ํ๋ก๊ทธ๋๋จธ์ค' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
โฌ [Programmers] [Java] [Level2] ์ต์๊ฐ ๋ง๋ค๊ธฐ (2) | 2024.01.03 |
---|---|
โฌ [Programmers] [Java] [Level2] JadenCase ๋ฌธ์์ด ๋ง๋ค๊ธฐ (1) | 2023.12.23 |
โฌ [Programmers] [Java] [Level1] ์๋ฆฟ์ ๋ํ๊ธฐ (0) | 2023.12.11 |
โฌ [Programmers] [Python] [Level3] ์ฌํ ๊ฒฝ๋ก (1) | 2023.05.10 |
โฌ [Programmers] [Python] [Level2] ์นด๋ ๋ญ์น (1) | 2023.05.10 |