Skip to content

Commit 2d6fe66

Browse files
authored
[20251129] PGM / Lv2 / 최댓값과 최솟값 / 이강현
1 parent 85103aa commit 2d6fe66

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
```java
2+
class Solution {
3+
public String solution(String s) {
4+
int min = Integer.MAX_VALUE;
5+
int max = Integer.MIN_VALUE;
6+
String[] splited = s.split(" ");
7+
8+
int idx = 0;
9+
for(String n : splited){
10+
int num = Integer.parseInt(n);
11+
min = Math.min(min, num);
12+
max = Math.max(max, num);
13+
}
14+
return min + " " + max;
15+
}
16+
}
17+
```

0 commit comments

Comments
 (0)