五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

leetcode892. Surface Area of 3D Shapes

2022-02-14 15:29 作者:您是打尖兒還是住店呢  | 我要投稿

You are given an?n x n?grid?where you have placed some?1 x 1 x 1?cubes. Each value?v = grid[i][j]?represents a tower of?v?cubes placed on top of cell?(i, j).

After placing these cubes, you have decided to glue any directly adjacent cubes to each other, forming several irregular 3D shapes.

Return?the total surface area of the resulting shapes.

Note:?The bottom face of each shape counts toward its surface area.

?

Example 1:

Input: grid = [[1,2],[3,4]]Output: 34

Example 2:

Input: grid = [[1,1,1],[1,0,1],[1,1,1]]Output: 32

Example 3:

Input: grid = [[2,2,2],[2,1,2],[2,2,2]]Output: 46

?

Constraints:

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

  • 1 <= n <= 50

  • 0 <= grid[i][j] <= 50

Accepted

27,339

Submissions

44,530



橫排重復(fù)(i),縱排重復(fù)(j),上下重復(fù)(i,j)>1時候的面算出來,然后正方體的總數(shù)*6-重復(fù)的面就能得出;

Success

Details?

Runtime:?3 ms, faster than?83.66%?of?Java?online submissions for?Surface Area of 3D Shapes.

Memory Usage:?45 MB, less than?7.78%?of?Java?online submissions for?Surface Area of 3D Shapes.


leetcode892. Surface Area of 3D Shapes的評論 (共 條)

分享到微博請遵守國家法律
二手房| 永春县| 宁远县| 马公市| 北票市| 建阳市| 闽侯县| 枣阳市| 汝州市| 鄢陵县| 肇庆市| 醴陵市| 荥阳市| 福州市| 丰原市| 太仆寺旗| 晋州市| 和田市| 威信县| 阿拉尔市| 句容市| 尚义县| 曲靖市| 久治县| 铜梁县| 台湾省| 荔波县| 大埔区| 肇庆市| 兰州市| 台南县| 庆云县| 海兴县| 潮州市| 新绛县| 当阳市| 彩票| 衡南县| 新田县| 鹤山市| 霍州市|