|
3 | 3 | importjava.util.ArrayList;
|
4 | 4 | importjava.util.List;
|
5 | 5 |
|
6 |
| -/** |
7 |
| - * 1314. Matrix Block Sum |
8 |
| - * |
9 |
| - * Given a m * n matrix mat and an integer K, |
10 |
| - * return a matrix answer where each answer[i][j] is the sum of all elements |
11 |
| - * mat[r][c] for i - K <= r <= i + K, j - K <= c <= j + K, and (r, c) is a valid position in the matrix. |
12 |
| - * |
13 |
| - * Example 1: |
14 |
| - * Input: mat = [[1,2,3],[4,5,6],[7,8,9]], K = 1 |
15 |
| - * Output: [[12,21,16],[27,45,33],[24,39,28]] |
16 |
| - * |
17 |
| - * Example 2: |
18 |
| - * Input: mat = [[1,2,3],[4,5,6],[7,8,9]], K = 2 |
19 |
| - * Output: [[45,45,45],[45,45,45],[45,45,45]] |
20 |
| - * |
21 |
| - * Constraints: |
22 |
| - * m == mat.length |
23 |
| - * n == mat[i].length |
24 |
| - * 1 <= m, n, K <= 100 |
25 |
| - * 1 <= mat[i][j] <= 100 |
26 |
| - * */ |
27 | 6 | publicclass_1314 {
|
28 | 7 | publicstaticclassSolution1 {
|
29 | 8 | publicint[][]matrixBlockSum(int[][]mat,intK) {
|
|