05 August 2008
给两个矩形,各自四个坐标,判断二者是否相交
1
2
3
4
5
6
7
8
class Solution {
public boolean isRectangleOverlap(int[] rec1, int[] rec2) {
if (rec1[0] >= rec2[2] || rec1[1] >= rec2[3] || rec1[2] <= rec2[0] || rec1[3] <= rec2[1]) {
return false;
}
return true;
}
}