Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6bcb99a

Browse files
이지영: [PG] 42884 단속카메라_241115
1 parent 655f25f commit 6bcb99a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

‎Programmers/Level3/JY_42884.java‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import java.util.*;
2+
3+
class Solution {
4+
public int solution(int[][] routes) {
5+
int answer = 0;
6+
7+
Arrays.sort(routes, (o1, o2)->o1[1]-o2[1]);
8+
9+
int last = -30001;
10+
for(int [] route: routes) {
11+
if(route[0] > last) {
12+
answer++;
13+
last = route[1];
14+
}
15+
}
16+
17+
return answer;
18+
}
19+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /