Easy False check ✅beats 100% | O(1) | C++
IntuitionTo determine if two rectangles overlap, the key insight is that rectangles will not overlap if one is completely above, below, to the left, or to the r
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
To determine if two rectangles overlap, the key insight is that rectangles will not overlap if one is completely above, below, to the left, or to the right of the other. The problem then boils down to checking these conditions using the rectangle boundaries. Special care is needed for edge-touching cases where rectangles may share edges but do not overlap.


# Approach
<!-- Describe your approach to solving the problem. -->
1. We extract the boundaries (coordinates) of the two rectangles from the input arrays. 
2. By comparing the boundaries, we check conditions where the rectangles cannot overlap: 
- One is completely above or below the other
- One is completely to the left or right of the other
- They touch along edges without overlapping.
3. If any of these conditions is true, the rectangles do not overlap, and we return false. 
4. Otherwise, they overlap, and we return true.



# Complexity
- Time complexity: **O(1)**
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity: **O(1)**
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
    bool isRectangleOverlap(vector<int>& rec1, vector<int>& rec2) {
        int x1_1=rec1[0], y1_1=rec1[1], x2_1=rec1[2], y2_1=rec1[3], x1_2=rec2[0], y1_2=rec2[1], x2_2=rec2[2], y2_2=rec2[3];
        
        if(y2_2<y1_1 // Second rectangle is vertically lower than first such that they cannot overlap
        || y2_1<y1_2 // First rectangle is vertically lower than second such that they cannot overlap
        || x2_2<x1_1 // Second rectangle is horizontally to left than first such that they cannot overlap
        || x2_1<x1_2 // First rectangle is horizontally to left than second such that they cannot overlap
        || (x1_2==x2_1 && ((y1_2>=y1_1 && y1_2<=y2_1) || (y2_2>=y1_1 && y2_2<=y2_1))) // Left edge of second rectangle overlapping with Right edge of first 
        || (x1_1==x2_2 && ((y1_2>=y1_1 && y1_2<=y2_1) || (y2_2>=y1_1 && y2_2<=y2_1)))  // Left edge of first rectangle overlapping with Right edge of second 
        || (y2_2==y1_1 && ((x2_2<=x2_1 && x2_2>=x1_1) || (x1_2<=x2_1 && x1_2>=x1_1))) // Top edge of second overlapping with Bottom edge of first
        || (y1_2==y2_1 && ((x2_2<=x2_1 && x2_2>=x1_1) || (x1_2<=x2_1 && x1_2>=x1_1))) // Top edge of first overlapping with Bottom edge of second
        ) return false; 
        return true;
    }
};
```
['Math', 'Geometry', 'C++']