The most fastest and shortest code in C++.


  • -5
    F

    class Solution {
    public:
    int computeArea(int A, int B, int C, int D, int E, int F, int G, int H) {
    return (C-A)(D-B)+(G-E)(H-F)-((C<E||F>D||H<B||G<A)?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.