Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution(object):
- def maxIncreaseKeepingSkyline(self, grid):
- """
- :type grid: List[List[int]]
- :rtype: int
- """
- colMax = [0] * len(grid[0])
- rowMax = []
- for i in grid:
- rowMax.append(max(i))
- for jdx, j in enumerate(i):
- colMax[jdx] = j if j > colMax[jdx] else colMax[jdx]
- print(rowMax, colMax)
- sum = 0
- for idx, i in enumerate(grid):
- for jdx, j in enumerate(i):
- sum += min(colMax[jdx],rowMax[idx]) - j
- return sum
- '''
- Runtime: 52 ms, faster than 91.92% of Python online submissions for Max Increase to Keep City Skyline.
- Memory Usage: 11.8 MB, less than 50.00% of Python online submissions for Max Increase to Keep City Skyline.
- '''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement