Python one liner


  • 1
    K
    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
            """
            return (C-A)*(D-B) + (G-E)*(H-F) - max(min(G, C) - max(E, A), 0) * max(min(D, H) - max(B, F), 0)
    

Log in to reply
 

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