Tap here to switch tabs
Problem
Submissions

Problem: Projection Area of 3D Shapes

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

Statement

You are given an n × n grid representing a three dimensional shape composed of 1×1×11 \times 1 \times 1 cubes aligned with the coordinate axes.

Each value grid[i][j] represents the height of a tower of cubes placed at the grid cell (i, j).

A projection is the shadow cast by the shape onto a two dimensional plane. The shape is projected onto three planes:

  • The top view (the xyxy plane)

  • The front view (the yzyz plane)

  • The side view (the zxzx plane)

Return the total combined area of all three projections.

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: Projection Area of 3D Shapes

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

Statement

You are given an n × n grid representing a three dimensional shape composed of 1×1×11 \times 1 \times 1 cubes aligned with the coordinate axes.

Each value grid[i][j] represents the height of a tower of cubes placed at the grid cell (i, j).

A projection is the shadow cast by the shape onto a two dimensional plane. The shape is projected onto three planes:

  • The top view (the xyxy plane)

  • The front view (the yzyz plane)

  • The side view (the zxzx plane)

Return the total combined area of all three projections.

Constraints:

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

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

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