# 836. Rectangle Overlap

![](https://4272748102-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LekNH5IywF8mjBxFcnu%2F-MiAakvBSgpHigz-E5Dt%2F-MiAqZMV3_UhEFhv_tUp%2Fimage.png?alt=media\&token=bbcaa4c3-23d2-424b-94ad-e5214335dcbd)

![](https://4272748102-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LekNH5IywF8mjBxFcnu%2F-MiAakvBSgpHigz-E5Dt%2F-MiAqawAI4ybPN0n1bYR%2Fimage.png?alt=media\&token=c3a5782e-694f-4fc1-9507-589123eaeaf3)

just draw the pic,&#x20;

draw the ways of no interaction in left, right, top , buttom, then can conduct the result.

time: O(1)

space:(1)

```java
class Solution {
    public boolean isRectangleOverlap(int[] rec1, int[] rec2) {
        return !(rec1[2] <= rec2[0] ||
                rec1[0] >= rec2[2] ||
                rec1[1] >= rec2[3] ||
                rec1[3] <= rec2[1]);
        
    }
}
```
