Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Rectangle Area
class Solution(object): def computeArea(self, A, B, C, D, E, F, G, H): r1 = abs(A-C) * abs(B-D) r2 = abs(E-G) * abs(F-H) #if there's no overlay if A>=G or C<= E or B>=H or D<=F: return r1+r2 else: #caculate the overlay r3 r3 = abs(max(A,E)-min(C,G))*abs(max(B,F)-min(D,H)) return r1+r2-r3
run
|
edit
|
history
|
help
0
rstring
python2 - division -1
PyEnum
NormalizedTags
trial
rstring
Цідило
Python regex to find repetitive word count
python permutations
thnii957