| 30 | """ |
| 31 | |
| 32 | class Solution(object): |
| 33 | def maxIncreaseKeepingSkyline(self, grid): |
| 34 | """ |
| 35 | :type grid: List[List[int]] |
| 36 | :rtype: int |
| 37 | """ |
| 38 | length = len(grid[0]) |
| 39 | |
| 40 | # Get line max. |
| 41 | line_dict = {str(index):max(data) for index, data in enumerate(grid)} |
| 42 | # Get column max. |
| 43 | column_dict = {str(index):max((grid[index2][index] for index2 in range(len(grid)))) for index in range(length)} |
| 44 | |
| 45 | total_increases = 0 |
| 46 | |
| 47 | for index, line in enumerate(grid): |
| 48 | for index2, cell in enumerate(line): |
| 49 | total_increases += min([line_dict[str(index)], column_dict[str(index2)]]) - cell |
| 50 | |
| 51 | return total_increases |
nothing calls this directly
no outgoing calls
no test coverage detected