In a 2 dimensional array grid, each value grid[i][j]represents the height of a building located there. We are allowed to increase the height of any number of buildings, by any amount (the amounts can be different for different buildings). Height 0 is…
class Solution { public: int maxIncreaseKeepingSkyline(vector<vector<int>>& grid) { //找出每一行的最大值 ; int ROW_HEIGHT[N]; int COL_HEIGHT[N]; int MIX_HEIGHT[N][N]; ; i < grid.size(); i++) { int max_height = INT_MIN; ; j < grid[].size(); j+…