package leetcode;

/**
 * https://leetcode.com/problems/max-increase-to-keep-city-skyline/
 */
public class Problem807 {
    public int maxIncreaseKeepingSkyline(int[][] grid) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem807 prob = new Problem807();
        System.out.println(prob.maxIncreaseKeepingSkyline(new int[][]{
            {3, 0, 8, 4}, {2, 4, 5, 7}, {9, 2, 6, 3}, {0, 3, 1, 0}
        })); // 35
    }
}

@@ -183,286 +183,884 @@
     
-// TODO%0A        return 0;%0A
+int nRow = grid.length;%0A        int nCol = 0;%0A        if (grid.length %3E 0) %7B%0A            nCol = grid%5B0%5D.length;%0A   
     
+ 
 %7D
-%0A
 %0A    
-public static void main(String%5B%5D args) %7B%0A        Problem807 prob = new Problem807();%0A        System.out.println(prob.maxIncreaseKeepingSkyline(new int%5B%5D%5B%5D%7B%0A            %7B3, 0, 8, 4%7D, %7B2, 4, 5, 7%7D, %7B9, 2, 6, 3%7D, %7B0, 3, 1, 0%7D%0A        %7D)); // 35
+    int%5B%5D maxRows = new int%5BnRow%5D;%0A        int%5B%5D maxCols = new int%5BnCol%5D;%0A%0A        for (int row = 0; row %3C nRow; row++) %7B%0A            for (int col = 0; col %3C nCol; col++) %7B%0A                maxRows%5Brow%5D = Math.max(maxRows%5Brow%5D, grid%5Brow%5D%5Bcol%5D);%0A                maxCols%5Bcol%5D = Math.max(maxCols%5Bcol%5D, grid%5Brow%5D%5Bcol%5D);%0A            %7D%0A        %7D%0A%0A        int result = 0;%0A        for (int row = 0; row %3C nRow; row++) %7B%0A            for (int col = 0; col %3C nCol; col++) %7B%0A                int max = Math.max(maxRows%5Brow%5D, maxCols%5Bcol%5D);%0A                int min = Math.min(maxRows%5Brow%5D, maxCols%5Bcol%5D);%0A                if (grid%5Brow%5D%5Bcol%5D %3C max) %7B%0A                    result += min - grid%5Brow%5D%5Bcol%5D;%0A                %7D%0A            %7D%0A        %7D%0A        return result;
 %0A   

Solve problem 807