【Leetcode_easy】892. Surface Area of 3D Shapes

problem

892. Surface Area of 3D Shapes

题意:感觉不清楚立方体是如何堆积的,所以也不清楚立方体之间是如何combine的。。

Essentially, compute the surface area of each grid but substract the overlapping areas.

All areas = surface + combined area
so we have surface = 6 * total_count - 2 * combined_count

 

solution1:

 

solution2:

 

参考

1. Leetcode_easy_892. Surface Area of 3D Shapes;

2. grandyang;

3.discuss;

posted on 2019-07-26 19:32  鹅要长大  阅读(129)  评论(0)    收藏  举报

导航