# 598.范围求和II

[https://leetcode-cn.com/problems/range-addition-ii/](https://leetcode-cn.com/problems/range-addition-ii/)

观察可知，操作完成后值最大的元素都集中在左上角 因为每个操作(a,b) 都对0 <= i < a 以及 0 <= j < b 的元素+1，即横坐标和纵坐标都会产生交集，因此每次对横纵坐标的范围分别求交集即可

```python
class Solution:
    def maxCount(self, m: int, n: int, ops: List[List[int]]) -> int:
        mina = m
        minb = n
        for op in ops:
            mina = min(mina, op[0])
            minb = min(minb, op[1])
        return mina * minb
```
