- Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy path_1476.java
29 lines (25 loc) · 853 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
packagecom.fishercoder.solutions.secondthousand;
publicclass_1476 {
publicstaticclassSolution1 {
publicstaticclassSubrectangleQueries {
int[][] matrix;
intm;
intn;
publicSubrectangleQueries(int[][] rectangle) {
m = rectangle.length;
n = rectangle[0].length;
matrix = rectangle;
}
publicvoidupdateSubrectangle(introw1, intcol1, introw2, intcol2, intnewValue) {
for (inti = row1; i <= row2; i++) {
for (intj = col1; j <= col2; j++) {
matrix[i][j] = newValue;
}
}
}
publicintgetValue(introw, intcol) {
returnmatrix[row][col];
}
}
}
}