File tree 1 file changed +3
-3
lines changed
src/main/java/com/fishercoder/solutions
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ public int compareTo(BuildingPoint o) {
38
38
}
39
39
}
40
40
41
- public List <int [] > getSkyline (int [][] buildings ) {
41
+ public List <List < Integer > > getSkyline (int [][] buildings ) {
42
42
BuildingPoint [] bps = new BuildingPoint [buildings .length * 2 ];
43
43
int index = 0 ;
44
44
for (int [] building : buildings ) {
@@ -51,7 +51,7 @@ public List<int[]> getSkyline(int[][] buildings) {
51
51
//this is one key step:
52
52
Arrays .sort (bps );
53
53
54
- List <int [] > result = new ArrayList ();
54
+ List <List < Integer > > result = new ArrayList ();
55
55
TreeMap <Integer , Integer > treeMap = new TreeMap ();
56
56
treeMap .put (0 , 1 );
57
57
int prevMaxH = 0 ;
@@ -74,7 +74,7 @@ public List<int[]> getSkyline(int[][] buildings) {
74
74
75
75
int currMaxH = treeMap .lastKey ();
76
76
if (currMaxH != prevMaxH ) {
77
- result .add (new int []{ bp .x , currMaxH } );
77
+ result .add (Arrays . asList ( bp .x , currMaxH ) );
78
78
prevMaxH = currMaxH ;
79
79
}
80
80
You can’t perform that action at this time.
0 commit comments