mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 03:33:12 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			38 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<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> </p>
 | 
						|
<p><strong class="example">Example 1:</strong></p>
 | 
						|
<img alt="" src="https://assets.leetcode.com/uploads/2020/10/02/ex1.jpg" style="width: 750px; height: 176px;" />
 | 
						|
<pre>
 | 
						|
<strong>Input:</strong> m = 3, n = 3, ops = [[2,2],[3,3]]
 | 
						|
<strong>Output:</strong> 4
 | 
						|
<strong>Explanation:</strong> The maximum integer in M is 2, and there are four of it in M. So return 4.
 | 
						|
</pre>
 | 
						|
 | 
						|
<p><strong class="example">Example 2:</strong></p>
 | 
						|
 | 
						|
<pre>
 | 
						|
<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]]
 | 
						|
<strong>Output:</strong> 4
 | 
						|
</pre>
 | 
						|
 | 
						|
<p><strong class="example">Example 3:</strong></p>
 | 
						|
 | 
						|
<pre>
 | 
						|
<strong>Input:</strong> m = 3, n = 3, ops = []
 | 
						|
<strong>Output:</strong> 9
 | 
						|
</pre>
 | 
						|
 | 
						|
<p> </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>
 |