Tap here to switch tabs
Problem
Submissions

Problem: Surface Area of 3D Shapes

med
30 min
Try to solve the Surface Area of 3D Shapes problem.

Statement

You are given an nimesnn imes n grid representing a layout of 1imes1imes11 imes 1 imes 1 unit cubes placed on top of each other. Each value grid[i][j] represents the number of cubes stacked vertically on the cell at row i and column j.

Return the total surface area of the resulting 3extD3 ext{D} shape formed by all the cubes.

Constraints:

  • n ==== grid.length ==== grid[i].length

  • 1≤1 \leq n ≤50\leq 50

  • 0≤0 \leq grid[i][j] ≤50\leq 50

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Surface Area of 3D Shapes

med
30 min
Try to solve the Surface Area of 3D Shapes problem.

Statement

You are given an nimesnn imes n grid representing a layout of 1imes1imes11 imes 1 imes 1 unit cubes placed on top of each other. Each value grid[i][j] represents the number of cubes stacked vertically on the cell at row i and column j.

Return the total surface area of the resulting 3extD3 ext{D} shape formed by all the cubes.

Constraints:

  • n ==== grid.length ==== grid[i].length

  • 1≤1 \leq n ≤50\leq 50

  • 0≤0 \leq grid[i][j] ≤50\leq 50