883. Projection Area of 3D Shapes Easy

@problem@discussion
#Array#Math#Geometry#Matrix



1/**
2 * [883] Projection Area of 3D Shapes
3 *
4 * You are given an n x n grid where we place some 1 x 1 x 1 cubes that are axis-aligned with the x, y, and z axes.
5 * Each value v = grid[i][j] represents a tower of v cubes placed on top of the cell (i, j).
6 * We view the projection of these cubes onto the xy, yz, and zx planes.
7 * A projection is like a shadow, that maps our 3-dimensional figure to a 2-dimensional plane. We are viewing the "shadow" when looking at the cubes from the top, the front, and the side.
8 * Return the total area of all three projections.
9 *  
10 * Example 1:
11 * <img alt="" src="https://s3-lc-upload.s3.amazonaws.com/uploads/2018/08/02/shadow.png" style="width: 800px; height: 214px;" />
12 * Input: grid = [[1,2],[3,4]]
13 * Output: 17
14 * Explanation: Here are the three projections ("shadows") of the shape made with each axis-aligned plane.
15 * 
16 * Example 2:
17 * 
18 * Input: grid = [[2]]
19 * Output: 5
20 * 
21 * Example 3:
22 * 
23 * Input: grid = [[1,0],[0,2]]
24 * Output: 8
25 * 
26 *  
27 * Constraints:
28 * 
29 * 	n == grid.length == grid[i].length
30 * 	1 <= n <= 50
31 * 	0 <= grid[i][j] <= 50
32 * 
33 */
34pub struct Solution {}
35
36// problem: https://leetcode.com/problems/projection-area-of-3d-shapes/
37// discuss: https://leetcode.com/problems/projection-area-of-3d-shapes/discuss/?currentPage=1&orderBy=most_votes&query=
38
39// submission codes start here
40
41impl Solution {
42    pub fn projection_area(grid: Vec<Vec<i32>>) -> i32 {
43        0
44    }
45}
46
47// submission codes end
48
49#[cfg(test)]
50mod tests {
51    use super::*;
52
53    #[test]
54    fn test_883() {
55    }
56}
57


Back
© 2025 bowen.ge All Rights Reserved.