Movatterモバイル変換


[0]ホーム

URL:


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

Commit5475768

Browse files
refactor 218
1 parent0430ec7 commit5475768

File tree

1 file changed

+3
-3
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+3
-3
lines changed

‎src/main/java/com/fishercoder/solutions/_218.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public int compareTo(BuildingPoint o) {
3838
}
3939
}
4040

41-
publicList<int[]>getSkyline(int[][]buildings) {
41+
publicList<List<Integer>>getSkyline(int[][]buildings) {
4242
BuildingPoint[]bps =newBuildingPoint[buildings.length *2];
4343
intindex =0;
4444
for (int[]building :buildings) {
@@ -51,7 +51,7 @@ public List<int[]> getSkyline(int[][] buildings) {
5151
//this is one key step:
5252
Arrays.sort(bps);
5353

54-
List<int[]>result =newArrayList();
54+
List<List<Integer>>result =newArrayList();
5555
TreeMap<Integer,Integer>treeMap =newTreeMap();
5656
treeMap.put(0,1);
5757
intprevMaxH =0;
@@ -74,7 +74,7 @@ public List<int[]> getSkyline(int[][] buildings) {
7474

7575
intcurrMaxH =treeMap.lastKey();
7676
if (currMaxH !=prevMaxH) {
77-
result.add(newint[]{bp.x,currMaxH});
77+
result.add(Arrays.asList(bp.x,currMaxH));
7878
prevMaxH =currMaxH;
7979
}
8080

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp