JAVA Solution | Easy to Understand Variable names | 100 %
The comment in the code is suffice to provide the wholesome picture of the problem. Would advise to look at the discussion in the comments of this: https://leet
The comment in the code is suffice to provide the wholesome picture of the problem. Would advise to look at the discussion in the comments of this: https://leetcode.com/problems/rectangle-overlap/discuss/132340/C%2B%2BJavaPython-1-line-Solution-1D-to-2D to get greater understanding of the problem.\n```\nclass Solution {\n    public boolean isRectangleOverlap(int[] rec1, int[] rec2) {\n\t    // to make rectangles overlapping, x1 needs to be smaller than x4 and x2 somewhere in between x3 and x4 \n\t    // x1----------x2\n        //       x3-----------x4\n        // same way y1,y2,y3 and y4 needed to be checked\n\t\t// y1\n\t\t// |\n\t\t// |     y3\n\t\t// |      |\n\t\t// y2     |\n\t\t//       y4\n        int x1=rec1[0],y1=rec1[1],x2=rec1[2],y2=rec1[3];\n        int x3=rec2[0],y3=rec2[1],x4=rec2[2],y4=rec2[3];\n        return x1<x4 && x3<x2 && y1<y4 && y3<y2;\n    }\n}\n```
[]