leetcode883】的更多相关文章

On a N * N grid, we place some 1 * 1 * 1 cubes that are axis-aligned with the x, y, and z axes. Each value v = grid[i][j] represents a tower of v cubes placed on top of grid cell (i, j). Now we view the projection of these cubes onto the xy, yz, and…
int projectionArea(vector<vector<int>>& grid) { ; ; ; ; i < grid.size(); i++) { row_max = ; ; j < grid[].size(); j++) { ) { sum++; } if (row_max < grid[i][j]) { row_max = grid[i][j]; } } sum += row_max; } ; j < grid[].size(); j…
在 N * N 的网格中,我们放置了一些与 x,y,z 三轴对齐的 1 * 1 * 1 立方体. 每个值 v = grid[i][j] 表示 v 个正方体叠放在单元格 (i, j) 上. 现在,我们查看这些立方体在 xy.yz 和 zx 平面上的投影. 投影就像影子,将三维形体映射到一个二维平面上. 在这里,从顶部.前面和侧面看立方体时,我们会看到"影子". 返回所有三个投影的总面积. 示例 1: 输入:[[2]] 输出:5 示例 2: 输入:[[1,2],[3,4]] 输出:17 解…