-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMergeIntervalsTest.java
More file actions
45 lines (40 loc) · 979 Bytes
/
MergeIntervalsTest.java
File metadata and controls
45 lines (40 loc) · 979 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import org.junit.Test;
import java.util.Arrays;
public class MergeIntervalsTest {
MergeIntervals solver = new MergeIntervals();
@Test
public void test1(){
int[][] intervals = {{1,3},{2,6},{8,10},{15,18}};
int[][] res = solver.merge(intervals);
for(int[] t: res){
System.out.println(Arrays.toString(t));
}
/**
* [1, 6]
* [8, 10]
* [15, 18]
*/
}
@Test
public void test2(){
int[][] intervals = {{1,4},{4,5}};
int[][] res = solver.merge(intervals);
for(int[] t: res){
System.out.println(Arrays.toString(t));
}
/**
* [1, 5]
*/
}
@Test
public void test3(){
int[][] intervals = {{1,4},{2,3}};
int[][] res = solver.merge(intervals);
for(int[] t: res){
System.out.println(Arrays.toString(t));
}
/**
* [1, 4]
*/
}
}