#-*- coding: UTF-8 -*-
#先判断是否有重叠
class Solution(object):
def computeArea(self, A, B, C, D, E, F, G, H):
"""
:type A: int
:type B: int
:type C: int
:type D: int
:type E: int
:type F: int
:type G: int
:type H: int
:rtype: int
"""
if C<=E or B>=H or A>=G or D<=F:
return (C-A)*(D-B)+(G-E)*(H-F)
width=min(C,G)-max(E,A)
height=min(D,H)-max(B,F)
return (C-A)*(D-B)+(G-E)*(H-F)-width*height
相关文章
- 10-06[LeetCode]223. Rectangle Area矩形面积
- 10-06LeetCode | 0836. Rectangle Overlap矩形重叠【Python】
- 10-06LeetCode-223 Rectangle Area
- 10-06#Leetcode# 223. Rectangle Area
- 10-06#Leetcode# 223. Rectangle Area
- 10-06[LeetCode] 223. Rectangle Area
- 10-06Leetcode 0223: Rectangle Area
- 10-06[LeetCode&Python] Problem 892. Surface Area of 3D Shapes
- 10-06[leetcode]python 695. Max Area of Island
- 10-06[LeetCode&Python] Problem 836. Rectangle Overlap