Skip to content

Commit c2efd66

Browse files
authored
Add files via upload
1 parent 08c73b8 commit c2efd66

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#define _for2(x, end) for(int x = 0; x < end; ++x)
2+
#define _for3(x, start, end) for(int x = start; x < end; ++x)
3+
class Solution {
4+
public:
5+
vector<vector<int>> largestLocal(vector<vector<int>>& grid) {
6+
vector<vector<int>> ans(grid.size() - 2, vector<int> (grid[0].size() - 2, 0));
7+
_for2(y, grid.size() - 2) {
8+
_for2(x, grid[0].size() - 2) {
9+
int max_num = 0;
10+
_for3(i, y, y + 3) {
11+
_for3(j, x, x + 3) {
12+
max_num = max(max_num, grid[i][j]);
13+
}
14+
}
15+
ans[y][x] = max_num;
16+
}
17+
}
18+
return ans;
19+
}
20+
};

0 commit comments

Comments
 (0)