Intuitive Graphical Explanations
Intuition\n Describe your first thoughts on how to solve this problem. \n1. Let\'s fixed rec1 and think about the conditions of rec2 that will overlap with rec1
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n1. Let\'s fixed `rec1` and think about the conditions of `rec2` that will overlap with `rec1`. See the graph below.\n![1.png](https://assets.leetcode.com/users/images/269f4ba5-0c09-428a-8faa-80c7e54e890b_1706591416.539316.png)\n\n2. The top-right corner of `rec2` must be on the top and right of the bottom-left corner of `rec1`. Graphically, if we use a red dot to represent the top-right corner of `rec2`, it must fall in the blue area (exclude boundaries).\nIn programming language: `rec1[0] < rec2[2] and rec1[1] < rec2[3]`\nIf the red dot is not in the blue area, there will be no overlap. Five situations are shown in green rectangles.\n![2.png](https://assets.leetcode.com/users/images/8e6bdfff-55e6-4905-959f-ddb528607ec4_1706593031.1090517.png)\n\n\n3. However, the above condition is not sufficient. If we don\'t control the bottom-left corner of `rec2`, `rec2` can be small enough to not overlap with `rec1`. See the graph below.\n![3.png](https://assets.leetcode.com/users/images/c3e8e957-8e40-46f5-a751-317acfc1dd47_1706593055.3193614.png)\n\n\n4. The additional condition has the same intuition as the previous one. That is, the bottom-left corner of `rec2` must be on the bottom and left of the top-right corner of `rec1`. Graphically, if we use a purple dot to represent the bottom-left corner of `rec2`, it must fall in the pink area (exclude boundaries as well).\nIn programming language: `rec1[2] > rec2[0] and rec1[3] > rec2[1]`\n![4.png](https://assets.leetcode.com/users/images/44d8a493-5535-4353-b5dc-0b4bbf7bcc0c_1706593280.8609776.png)\n\n5. Use `and` to combine the above two conditions.\n\n# Code\n```\nclass Solution:\n    def isRectangleOverlap(self, rec1: List[int], rec2: List[int]) -> bool:\n        return rec1[0] < rec2[2] and rec1[1] < rec2[3] and rec1[2] > rec2[0] and rec1[3] > rec2[1]\n```
['Python3']