mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-13 11:21:42 +08:00
add leetcode problem-cn part3
This commit is contained in:
43
算法题(国内版)/problem (Chinese)/范围求和 II [range-addition-ii].html
Normal file
43
算法题(国内版)/problem (Chinese)/范围求和 II [range-addition-ii].html
Normal file
@@ -0,0 +1,43 @@
|
||||
<p>给你一个 <code>m x n</code> 的矩阵 <code>M</code><strong> </strong>,初始化时所有的 <code>0</code> 和一个操作数组 <code>op</code> ,其中 <code>ops[i] = [ai, bi]</code> 意味着当所有的 <code>0 <= x < ai</code> 和 <code>0 <= y < bi</code> 时, <code>M[x][y]</code> 应该加 1。</p>
|
||||
|
||||
<p>在 <em>执行完所有操作后</em> ,计算并返回 <em>矩阵中最大整数的个数</em> 。</p>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>示例 1:</strong></p>
|
||||
|
||||
<p><img alt="" src="https://assets.leetcode.com/uploads/2020/10/02/ex1.jpg" style="height: 176px; width: 750px;" /></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong> m = 3, n = 3,ops = [[2,2],[3,3]]
|
||||
<strong>输出:</strong> 4
|
||||
<strong>解释:</strong> M 中最大的整数是 2, 而且 M 中有4个值为2的元素。因此返回 4。
|
||||
</pre>
|
||||
|
||||
<p><strong>示例 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong> m = 3, n = 3, ops = [[2,2],[3,3],[3,3],[3,3],[2,2],[3,3],[3,3],[3,3],[2,2],[3,3],[3,3],[3,3]]
|
||||
<strong>输出:</strong> 4
|
||||
</pre>
|
||||
|
||||
<p><strong>示例 3:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong> m = 3, n = 3, ops = []
|
||||
<strong>输出:</strong> 9
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>提示:</strong></p>
|
||||
|
||||
<p><meta charset="UTF-8" /></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= m, n <= 4 * 10<sup>4</sup></code></li>
|
||||
<li><code>0 <= ops.length <= 10<sup>4</sup></code></li>
|
||||
<li><code>ops[i].length == 2</code></li>
|
||||
<li><code>1 <= a<sub>i</sub> <= m</code></li>
|
||||
<li><code>1 <= b<sub>i</sub> <= n</code></li>
|
||||
</ul>
|
Reference in New Issue
Block a user