598. Range Addition II Easy
1/**
2 * [598] Range Addition II
3 *
4 * You are given an m x n matrix M initialized with all 0's and an array of operations ops, where ops[i] = [ai, bi] means M[x][y] should be incremented by one for all 0 <= x < ai and 0 <= y < bi.
5 * Count and return the number of maximum integers in the matrix after performing all the operations.
6 *
7 * Example 1:
8 * <img alt="" src="https://assets.leetcode.com/uploads/2020/10/02/ex1.jpg" style="width: 750px; height: 176px;" />
9 * Input: m = 3, n = 3, ops = [[2,2],[3,3]]
10 * Output: 4
11 * Explanation: The maximum integer in M is 2, and there are four of it in M. So return 4.
12 *
13 * Example 2:
14 *
15 * Input: 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]]
16 * Output: 4
17 *
18 * Example 3:
19 *
20 * Input: m = 3, n = 3, ops = []
21 * Output: 9
22 *
23 *
24 * Constraints:
25 *
26 * 1 <= m, n <= 4 * 10^4
27 * 0 <= ops.length <= 10^4
28 * ops[i].length == 2
29 * 1 <= ai <= m
30 * 1 <= bi <= n
31 *
32 */
33pub struct Solution {}
34
35// problem: https://leetcode.com/problems/range-addition-ii/
36// discuss: https://leetcode.com/problems/range-addition-ii/discuss/?currentPage=1&orderBy=most_votes&query=
37
38// submission codes start here
39
40impl Solution {
41 pub fn max_count(m: i32, n: i32, ops: Vec<Vec<i32>>) -> i32 {
42 0
43 }
44}
45
46// submission codes end
47
48#[cfg(test)]
49mod tests {
50 use super::*;
51
52 #[test]
53 fn test_598() {
54 }
55}
56
Back
© 2025 bowen.ge All Rights Reserved.