Given a 2D matrix whose size is N * N, and a 2D sliding window whose size is M * M. Our goal is to find the maximum in each sliding window. The sliding window will start from the left-top corner, in each iteration, the sliding window will move 1 unit only, and it will stop after going through the whole matrix.
For example, given a 2D matrix
and a 2 * 2 sliding window,
then the output will be
The first line is the matrix size N, where 3 ≤ N ≤ 15.
The second line is the sliding window size M, where 2 ≤ M < N.
Then the following N*N numbers are the elements of this matrix, the value of these elements is ranged from 1 to 10000.
The new 2D matrix.
Use “%5d” to print each element and do not print any additional space!
You need to print a newline character at the end of each line. ('\n')