Geometry

892 Surface Area of 3D Shapes

Intuition:
For each tower, its surface area is 4 * v + 2
However, 2 adjacent tower will hide the area of connected part.
The hidden part is min(v1, v2) and we need just minus this area * 2
Time Complexity:
O(N^2)



963 Minimum Area Rectangle II

Iterate all possible triangles and check the opposite points that creating a quadrilateral.
Time complexity: O(n^3)
Space complexity: O(n)

Comments

Popular posts from this blog

zhitongguigu

Array Part2

Two pointers (Part 1)