598. 区间加法 II
Problem:
思路
脑筋急转弯:因为左上角的矩阵一直在累加,所以统计最小的行和列即可
Code
class Solution {
public int maxCount(int m, int n, int[][] ops) {
int r = m;
int l = n;
for (int i = 0; i < ops.length; i++) {
// System.out.println(ops[i][0] + "," + ops[i][1] + "," + r + "," + l);
r = Math.min(r, ops[i][0]);
l = Math.min(l, ops[i][1]);
// System.out.println(ops[i][0] + "," + ops[i][1] + "," + r + "," + l);
}
return r * l;
}
}