1
class SubrectangleQueries {
2
int[][] rectangle;
3

4
public SubrectangleQueries(int[][] rectangle) {
5
this.rectangle = rectangle;
6
}
7

8
public void updateSubrectangle(int row1, int col1, int row2, int col2, int newValue) {
9
for (int i = row1; i <= row2; i++) {
10
for (int j = col1; j <= col2; j++) {
11
rectangle[i][j] = newValue;
12
}
13
}
14
}
15

16
public int getValue(int row, int col) {
17
return this.rectangle[row][col];
18
}
19
}
20

21
/**
22
* Your SubrectangleQueries object will be instantiated and called as such: SubrectangleQueries obj
23
* = new SubrectangleQueries(rectangle); obj.updateSubrectangle(row1,col1,row2,col2,newValue); int
24
* param_2 = obj.getValue(row,col);
25
*/

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0