We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parent0430ec7 commit5475768Copy full SHA for 5475768
src/main/java/com/fishercoder/solutions/_218.java
@@ -38,7 +38,7 @@ public int compareTo(BuildingPoint o) {
38
}
39
40
41
-publicList<int[]>getSkyline(int[][]buildings) {
+publicList<List<Integer>>getSkyline(int[][]buildings) {
42
BuildingPoint[]bps =newBuildingPoint[buildings.length *2];
43
intindex =0;
44
for (int[]building :buildings) {
@@ -51,7 +51,7 @@ public List<int[]> getSkyline(int[][] buildings) {
51
//this is one key step:
52
Arrays.sort(bps);
53
54
-List<int[]>result =newArrayList();
+List<List<Integer>>result =newArrayList();
55
TreeMap<Integer,Integer>treeMap =newTreeMap();
56
treeMap.put(0,1);
57
intprevMaxH =0;
@@ -74,7 +74,7 @@ public List<int[]> getSkyline(int[][] buildings) {
74
75
intcurrMaxH =treeMap.lastKey();
76
if (currMaxH !=prevMaxH) {
77
-result.add(newint[]{bp.x,currMaxH});
+result.add(Arrays.asList(bp.x,currMaxH));
78
prevMaxH =currMaxH;
79
80