forked from fishercoder1534/Leetcode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_1476.java
29 lines (25 loc) · 838 Bytes
/
_1476.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package com.fishercoder.solutions;
public class _1476 {
public static class Solution1 {
public static class SubrectangleQueries {
int[][] matrix;
int m;
int n;
public SubrectangleQueries(int[][] rectangle) {
m = rectangle.length;
n = rectangle[0].length;
matrix = rectangle;
}
public void updateSubrectangle(int row1, int col1, int row2, int col2, int newValue) {
for (int i = row1; i <= row2; i++) {
for (int j = col1; j <= col2; j++) {
matrix[i][j] = newValue;
}
}
}
public int getValue(int row, int col) {
return matrix[row][col];
}
}
}
}