Leetcode 807. Max Increase to Keep City Skyline

Posted 周洋的Blog

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Leetcode 807. Max Increase to Keep City Skyline相关的知识,希望对你有一定的参考价值。

class Solution(object):
    def maxIncreaseKeepingSkyline(self, grid):
        """
        :type grid: List[List[int]]
        :rtype: int
        """
        import numpy as np
        grid=np.array(grid)
        ori=grid.sum()
        for i, _ in enumerate(grid):
            for j, _ in enumerate(grid[i]):
                grid[i][j] = min(max(grid[i]), max(grid[:,j]))
        print(grid)
        ans=0
        for i,_ in enumerate(grid):
            ans+=sum(grid[i])
        return ans-ori

 

以上是关于Leetcode 807. Max Increase to Keep City Skyline的主要内容,如果未能解决你的问题,请参考以下文章

LeetCode 807. Max Increase to Keep City Skyline

Leetcode 807. Max Increase to Keep City Skyline

解题报告Leecode 807. 保持城市天际线——Leecode每日刷题系列

解题报告Leecode 807. 保持城市天际线——Leecode每日刷题系列

807. Max Increase to Keep City Skyline

807. Max Increase to Keep City Skyline