Skip to content

Commit 4234d97

Browse files
authored
[20251113] PGM / LV3 / 단속카메라 / 강신지
1 parent d303c41 commit 4234d97

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
```java
2+
import java.util.*;
3+
4+
class Solution {
5+
public int solution(int[][] routes) {
6+
Arrays.sort(routes, (a, b) -> Integer.compare(a[1], b[1]));
7+
8+
int answer = 0;
9+
int camera = Integer.MIN_VALUE;
10+
11+
for (int[] r : routes){
12+
int s = r[0];
13+
int e = r[1];
14+
15+
if (camera < s){
16+
camera = e;
17+
answer++;
18+
}
19+
}
20+
21+
return answer;
22+
}
23+
}
24+
```

0 commit comments

Comments
 (0)