Geometry
892 Surface Area of 3D Shapes
Intuition:
For each tower, its surface area is
However, 2 adjacent tower will hide the area of connected part.
The hidden part is
For each tower, its surface area is
4 * v + 2However, 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)
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)
Space complexity: O(n)
Comments
Post a Comment