可以形成最大正方形的矩形数目
力扣链接
代码
class Solution {
public int countGoodRectangles(int[][] rectangles) {
int res = 0;
int maxLen = 0;
for (int[] rectangle : rectangles) {
int l = rectangle[0];
int w = rectangle[1];
int min = Math.min(l, w);
if (min == maxLen) {
++res;
} else if (maxLen < min) {
maxLen = min;
res = 1;
}
}
return res;
}
}