码迷,mamicode.com
首页 > 其他好文 > 详细

Leetcode 807. Max Increase to Keep City Skyline

时间:2019-04-04 09:56:12      阅读:128      评论:0      收藏:0      [点我收藏+]

标签:type   code   etc   max   object   bsp   int   grid   lin   

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

标签:type   code   etc   max   object   bsp   int   grid   lin   

原文地址:https://www.cnblogs.com/zywscq/p/10652718.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!