Overlapping intervals || C++
Intuition\ncheck each pair of reactangles. check for overlap. if overlap then find the square of max area.\n\n# Approach\nnested loop to check each pair.\ncheck
# Intuition\ncheck each pair of reactangles. check for overlap. if overlap then find the square of max area.\n\n# Approach\nnested loop to check each pair.\ncheck for overlap in x-axis. if overlap then check if y also overlap.\nif do then find the max area of square.\nfind max x width of overlaping x region.\nfind max y length of overlapping y region.\ntake minimum of x and y and find area.\n\n# Complexity\n- Time complexity:\n$$O(n^2)$$\n\n- Space complexity:\n$$O(1)$$\n\n# Code\n```\nclass Solution {\npublic:\n    bool isOverLap(vector<int> &bl1,vector<int> &tr1,vector<int> &bl2,vector<int> &tr2){\n        bool x = tr1[0]>=bl2[0] && tr2[0]>=bl1[0];\n        bool y = tr1[1]>=bl2[1] && tr2[1]>=bl1[1];\n        return x&y;\n    }\n    long long CommonArea(vector<int> &bl1,vector<int> &tr1,vector<int> &bl2,vector<int> &tr2){\n        long long max_c_w = min(tr1[0],tr2[0])-max(bl1[0],bl2[0]);\n        long long max_c_h = min(tr1[1],tr2[1])-max(bl1[1],bl2[1]);\n        long long mn = min(max_c_w,max_c_h);\n        return mn*mn;\n    }\n    long long largestSquareArea(vector<vector<int>>& bL, vector<vector<int>>& tR) {\n        long long max_area = 0;\n        int n = bL.size();\n        for(int i=0;i<n;i++){\n            for(int j=i+1;j<n;j++){\n                if(isOverLap(bL[i],tR[i],bL[j],tR[j])) max_area = max(max_area,CommonArea(bL[i],tR[i],bL[j],tR[j]));\n            }\n        }\n        return max_area;\n    }\n};\n```
['C++']