# Leetcode 883. Projection Area of 3D Shapes **Explanation** --------------- front-back projection area on xz = `sum(max value for every col)` right-left projection area on yz = `sum(max value for every row)` top-down projection area on xy = `sum(1 for every v > 0)` **Diagram** ----------- I drawn this diagram to help understand. ![](https://s3-lc-upload.s3.amazonaws.com/uploads/2018/08/02/shadow.png) **Complexity** -------------- Time `O(N^2)` for one pass. Space `O(1)` extra space. ```python= class Solution: def projectionArea(self, grid: List[List[int]]) -> int: rows = len(grid) cols = len(grid[0]) output = 0 for row in range(rows): xz = 0 yz = 0 for col in range(cols): if grid[row][col] > 0: output += 1 xz = max(xz,grid[row][col]) yz = max(yz,grid[col][row]) output += xz output += yz return output ```