2025-08-01 10:12:38 +0000 UTC
Projection Area of 3D Shapes
Categories:
Links
Code
class Solution:
def projectionArea(self, grid: list[list[int]]) -> int:
res = 0
length = len(grid)
for i in range(length):
best_row = 0
best_col = 0
for j in range(length):
if grid[i][j]:
res += 1
best_row = max(best_row, grid[i][j])
best_col = max(best_col, grid[j][i])
res += best_row + best_col
return res