---
title: leetcode-836
date: 2020-03-25 22:41:25
tags:
categories: leetcode
---

### 836. 矩形重叠

[题目](https://leetcode-cn.com/problems/rectangle-overlap/)



<!--more-->



看两个矩形有没有重叠，就看两个矩形在坐标轴上的投影有没有重叠。



```python
class Solution:
  def isRectangleOverlap(self, rec1, rec2) -> bool:
     return ((min(rec1[2], rec2[2]) > max(rec1[0], rec2[0]))
             and (min(rec1[3], rec2[3]) > max(rec1[1], rec2[1])))

s = Solution()
s.isRectangleOverlap(rec1 = [0,0,2,2], rec2 = [1,1,3,3])

#40 ms	13.7 MB
```

