One line Python solution


  • 1
    L
    class Solution(object):
    def computeArea(self, A, B, C, D, E, F, G, H):
        return ((C - A) * (D - B) + (G - E) * (H - F)) - reduce(lambda x, y: (x*y*(x > 0 and y > 0)), (min(C, G) - max(A, E), min(D, H) - max(B, F)))

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.