Skip to content

Commit 45c3df0

Browse files
refactor 807
1 parent 7189285 commit 45c3df0

File tree

1 file changed

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

1 file changed

+0
-36
lines changed

src/main/java/com/fishercoder/solutions/_807.java

-36
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,5 @@
11
package com.fishercoder.solutions;
22

3-
import com.fishercoder.common.utils.CommonUtils;
4-
5-
/**
6-
* 807. Max Increase to Keep City Skyline
7-
*
8-
* In a 2 dimensional array grid, each value grid[i][j] represents the height of a building located there.
9-
* We are allowed to increase the height of any number of buildings,
10-
* by any amount (the amounts can be different for different buildings). Height 0 is considered to be a building as well.
11-
* At the end, the "skyline" when viewed from all four directions of the grid, i.e. top, bottom, left, and right,
12-
* must be the same as the skyline of the original grid. A city's skyline is the outer contour of the rectangles
13-
* formed by all the buildings when viewed from a distance. See the following example.
14-
* What is the maximum total sum that the height of the buildings can be increased?
15-
*
16-
* Example:
17-
* Input: grid = [[3,0,8,4],[2,4,5,7],[9,2,6,3],[0,3,1,0]]
18-
* Output: 35
19-
* Explanation:
20-
* The grid is:
21-
* [ [3, 0, 8, 4],
22-
* [2, 4, 5, 7],
23-
* [9, 2, 6, 3],
24-
* [0, 3, 1, 0] ]
25-
*
26-
* The skyline viewed from top or bottom is: [9, 4, 8, 7]
27-
* The skyline viewed from left or right is: [8, 7, 9, 3]
28-
* The grid after increasing the height of buildings without affecting skylines is:
29-
* gridNew = [ [8, 4, 8, 7],
30-
* [7, 4, 7, 7],
31-
* [9, 4, 8, 7],
32-
* [3, 3, 3, 3] ]
33-
*
34-
* Notes:
35-
* 1 < grid.length = grid[0].length <= 50.
36-
* All heights grid[i][j] are in the range [0, 100].
37-
* All buildings in grid[i][j] occupy the entire grid cell: that is, they are a 1 x 1 x grid[i][j] rectangular prism.
38-
* */
393
public class _807 {
404
public static class Solution1 {
415
public int maxIncreaseKeepingSkyline(int[][] grid) {

0 commit comments

Comments
 (0)