【leetcode】598. Range Addition II
2024-09-05 11:43:36
You are given an m x n matrix M initialized with all 0's and an array of operations ops, where ops[i] = [ai, bi] means M[x][y] should be incremented by one for all 0 <= x < ai and 0 <= y < bi.
Count and return the number of maximum integers in the matrix after performing all the operations.
class Solution {
public:
int maxCount(int m, int n, vector<vector<int>>& ops) { //取所有操作的交集就是最大int number的个数 冷静思考就没问题 啊哈哈哈
if(ops.size()==0) return m*n;
int limit_m=m,limit_n=n;
for(auto aa:ops)
{
limit_m=min(limit_m,aa[0]);
limit_n=min(limit_n,aa[1]);
}
return limit_m*limit_n;
}
};
最新文章
- ActiveMQ结合Spring开发
- 自己封装一个Log模块
- php 时间倒计时
- {dockerUI}在服务器上直接安装shipyard/shipyard
- hadoop的ganglia数据监控
- c# 自定义多选下拉列表2
- NSURLConnection从入门到放弃
- SpringMVC(二):RequestMapping修饰类、指定请求方式、请求参数或请求头、支持Ant路径
- android获取短信并自动填充
- eclipse使用报错集锦
- day24 Pythonpython 面向对象设计 类
- [2017-7-26]Android Learning Day4
- SpringBoot 使用validation数据校验
- Lily-一个埋点管理工具
- 全网最详细的Windows系统里Oracle 11g R2 Database(64bit)安装后的初步使用(图文详解)
- 【爬坑】在 IDEA 中运行 Hadoop 程序 报 winutils.exe 不存在错误解决方案
- .NET版UEditor报请求后台配置项http错误,上传功能无法使用的错误解决
- Linux中的任务调度
- 【经典数据结构】Trie
- BZOJ4892 Tjoi2017dna(后缀数组)
热门文章
- Android Studio 查看SQLite数据库存储位置及文件
- no space left on device 磁盘空间不足
- c++学习笔记6(结构化程序设计)
- 问题 K: A/B Problem
- CodeGuide 300+文档、100+代码库,一个指导程序员写代码的,Github 仓库开源啦!
- 大爽Python入门教程 3-3 循环:`for`、`while`
- ajax的get方法获取豆瓣电影前10页的数据
- PLSQL 删表 恢复
- Windows11 如何让开始菜单出现休眠选项(Windows11如何开启休眠功能?)Windows家庭版
- 动图图解!怎么让goroutine跑一半就退出?