|
3 | 3 | ## 题目
|
4 | 4 |
|
5 | 5 | Given an m * n matrix M initialized with all 0's and several update operations.
|
6 |
| -Operations are represented by a 2D array, and each operation is represented by an array with two positive integers a and b, which means M[i][j] should be added by one for all 0 <= i < a and 0 <= j < b. |
| 6 | +Operations are represented by a 2D array, and each operation is represented by an array with two positive integers a and b, which means M[i][j] should be added by one for all 0 <= i < a and 0 <= j < b. |
7 | 7 | You need to count and return the number of maximum integers in the matrix after performing all the operations.
|
8 | 8 |
|
9 | 9 | Example 1:
|
10 |
| -Input: |
| 10 | + |
| 11 | +```text |
| 12 | +Input: |
11 | 13 | m = 3, n = 3
|
12 | 14 | operations = [[2,2],[3,3]]
|
13 | 15 | Output: 4
|
14 |
| -Explanation: |
15 |
| -Initially, M = |
| 16 | +Explanation: |
| 17 | +Initially, M = |
16 | 18 | [[0, 0, 0],
|
17 | 19 | [0, 0, 0],
|
18 | 20 | [0, 0, 0]]
|
19 | 21 |
|
20 |
| -After performing [2,2], M = |
| 22 | +After performing [2,2], M = |
21 | 23 | [[1, 1, 0],
|
22 | 24 | [1, 1, 0],
|
23 | 25 | [0, 0, 0]]
|
24 | 26 |
|
25 |
| -After performing [3,3], M = |
| 27 | +After performing [3,3], M = |
26 | 28 | [[2, 2, 1],
|
27 | 29 | [2, 2, 1],
|
28 | 30 | [1, 1, 1]]
|
29 | 31 |
|
30 | 32 | So the maximum integer in M is 2, and there are four of it in M. So return 4.
|
31 |
| - |
32 |
| - |
| 33 | +``` |
33 | 34 |
|
34 | 35 | Note:
|
35 | 36 |
|
36 |
| -The range of m and n is [1,40000]. |
37 |
| -The range of a is [1,m], and the range of b is [1,n]. |
38 |
| -The range of operations size won't exceed 10,000. |
| 37 | +1. The range of m and n is [1,40000]. |
| 38 | +1. The range of a is [1,m], and the range of b is [1,n]. |
| 39 | +1. The range of operations size won't exceed 10,000. |
39 | 40 |
|
40 | 41 | ## 解题思路
|
41 | 42 |
|
|
0 commit comments