Skip to content

Commit 442ef44

Browse files
authored
Merge pull request #1174 from AlgorithmWithGod/0224LJH
[20251020] PGM / LV2 / 최솟값과 최댓값 / 이종환
2 parents 39aa427 + 8f9fb9e commit 442ef44

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
```java
2+
import java.io.*;
3+
import java.util.*;
4+
5+
class Solution {
6+
public String solution(String s) {
7+
StringTokenizer st = new StringTokenizer(s);
8+
int min = Integer.MAX_VALUE;
9+
int max = Integer.MIN_VALUE;
10+
while(st.hasMoreTokens()){
11+
int num = Integer.parseInt(st.nextToken());
12+
min = Math.min(min,num);
13+
max = Math.max(max,num);
14+
}
15+
StringBuilder sb = new StringBuilder();
16+
sb.append(min).append(" ").append(max);
17+
String answer = sb.toString();
18+
return answer;
19+
}
20+
}
21+
```

0 commit comments

Comments
 (0)