Class Solution
java.lang.Object
g0501_0600.s0598_range_addition_ii.Solution
598 - Range Addition II.<p>Easy</p>
<p>You are given an <code>m x n</code> matrix <code>M</code> initialized with all <code>0</code>’s and an array of operations <code>ops</code>, where <code>ops[i] = [a<sub>i</sub>, b<sub>i</sub>]</code> means <code>M[x][y]</code> should be incremented by one for all <code>0 <= x < a<sub>i</sub></code> and <code>0 <= y < b<sub>i</sub></code>.</p>
<p>Count and return <em>the number of maximum integers in the matrix after performing all the operations</em>.</p>
<p><strong>Example 1:</strong></p>
<p><img src="https://assets.leetcode.com/uploads/2020/10/02/ex1.jpg" alt="" /></p>
<p><strong>Input:</strong> m = 3, n = 3, ops = [[2,2],[3,3]]</p>
<p><strong>Output:</strong> 4</p>
<p><strong>Explanation:</strong> The maximum integer in M is 2, and there are four of it in M. So return 4.</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</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]]</p>
<p><strong>Output:</strong> 4</p>
<p><strong>Example 3:</strong></p>
<p><strong>Input:</strong> m = 3, n = 3, ops = []</p>
<p><strong>Output:</strong> 9</p>
<p><strong>Constraints:</strong></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>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
maxCount
public int maxCount(int m, int n, int[][] ops)
-