No.190 - LeetCode836. Rectangle Overlap - 几何 - 整点矩形相交判断
条件:必须是整点矩形
思路:两个矩形左下点中的右上点,必须在两个矩形右上点中的左下点的左下侧。
class Solution {
public:
bool isRectangleOverlap(vector<int>& rec1, vector<int>& rec2) {
int x1 = max(rec1[0],rec2[0]);
int y1 = max(rec1[1],rec2[1]);
int x2 =
原创
2020-07-04 17:57:58 ·
275 阅读 ·
0 评论