We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent db77ba8 commit a5c74e0Copy full SHA for a5c74e0
solution/0883.Projection Area of 3D Shapes/Solution.java
@@ -0,0 +1,26 @@
1
+class Solution {
2
+ public int projectionArea(int[][] grid) {
3
+ int n = grid.length;
4
+ int res = 0;
5
+ for (int i = 0; i < n; ++i) {
6
+ for (int j = 0; j < n; ++j) {
7
+ res += grid[i][j] > 0 ? 1 : 0;
8
+ }
9
10
11
+ int max = 0;
12
13
+ max = Math.max(max, grid[i][j]);
14
15
+ res += max;
16
17
18
19
20
21
22
23
24
+ return res;
25
26
+}
0 commit comments