Leetcode—598. 区间加法 II【简单】
2025每日刷题(206)
Leetcode—598. 区间加法 II
实现代码
class Solution {
public:
int maxCount(int m, int n, vector<vector<int>>& ops) {
int ans = m * n;
int x = ops.size();
if(ops.empty()) {
return ans;
}
int xm = ops[0][0], ym = ops[0][1];
for(int i = 0; i < x; i++) {
if(xm >= ops[i][0]) {
xm = ops[i][0];
}
if(ym >= ops[i][1]) {
ym = ops[i][1];
}
}
return min(ans, xm * ym);
}
};
运行结果
之后我会持续更新,如果喜欢我的文章,请记得一键三连哦,点赞关注收藏,你的每一个赞每一份关注每一次收藏都将是我前进路上的无限动力 !!!↖(▔▽▔)↗感谢支持!