Range Addition II Problem
Range Addition II Problem — ExecCode Easy DSA Practice
Solve the Range Addition II problem on ExecCode. Free online easy DSA practice in Arrays - Logic Building. Write and run code in Java, C++, Python — no signup required to run.
Problem description
Description 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. Your task is to count and return the number of maximum integers in the matrix after performing all the operations.
Examples
Input {"m": 3, "n": 3, "ops": [[2, 2], [3, 3]]}; Output 4. 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]]}; Output 4
Constraints
1 <= m, n <= 4 * 10^4 0 <= ops.length <= 10^4 ops[i].length == 2 1 <= ai <= m 1 <= bi <= n
Practice Range Addition II free on ExecCode. Browse DSA problems, topic map, and placement guides.