File tree 1 file changed +5
-7
lines changed
src/main/java/com/fishercoder/solutions
1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change 1
1
package com .fishercoder .solutions ;
2
2
3
- import com .fishercoder .common .classes .Interval ;
4
-
5
3
import java .util .ArrayList ;
6
4
import java .util .Collections ;
7
5
import java .util .List ;
8
6
9
7
public class _252 {
10
8
public static class Solution1 {
11
- public boolean canAttendMeetings (Interval [] intervals ) {
9
+ public boolean canAttendMeetings (int [] [] intervals ) {
12
10
13
- List <Interval > list = new ArrayList ();
14
- for (Interval interval : intervals ) {
11
+ List <int [] > list = new ArrayList ();
12
+ for (int [] interval : intervals ) {
15
13
list .add (interval );
16
14
}
17
15
18
16
Collections .sort (list , (o1 , o2 ) -> {
19
- if (o1 . start > o2 . start ) {
17
+ if (o1 [ 0 ] > o2 [ 0 ] ) {
20
18
return 1 ;
21
19
} else {
22
20
return -1 ;
23
21
}
24
22
});
25
23
26
24
for (int i = 0 ; i < list .size () - 1 ; i ++) {
27
- if (list .get (i ). end > list .get (i + 1 ). start ) {
25
+ if (list .get (i )[ 1 ] > list .get (i + 1 )[ 0 ] ) {
28
26
return false ;
29
27
}
30
28
}
You can’t perform that action at this time.
0 commit comments