Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
17 lines (15 loc) · 592 Bytes

File metadata and controls

17 lines (15 loc) · 592 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package leetcode;
import java.util.Map;
public class leetcode836 {
/*
* 矩阵重叠-》区间重叠
* 如果两个矩阵重叠,那么它们重叠的区域一定也是一个矩形,那么这代表了两个矩形
* 在x轴、y轴的投影都有相交的地方
* 两个区间为(x1,y1) (x2,y2)
* min(y1,y2)>max(x1,x2) 时两个区间重叠
* */
public boolean isRectangleOverlap(int[] rec1, int[] rec2) {
return (Math.min(rec1[2],rec2[2])>Math.max(rec1[0],rec2[0])&&
Math.min(rec1[3],rec2[3])>Math.max(rec1[1],rec2[1]));
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.