Given a grid grid, a non-negative integer k and a value fill, return a new grid with k
layers of fill added on every side. A grid with R rows and C columns becomes one with R + 2k
rows and C + 2k columns.
Examples
Input: grid = [[1, 2],
[3, 4]], k = 1, fill = 0
Output: [[0, 0, 0, 0],
[0, 1, 2, 0],
[0, 3, 4, 0],
[0, 0, 0, 0]]
Input: grid = [[7]], k = 0, fill = 9
Output: [[7]]
Constraints
1 <= rows, cols <= 60,0 <= k <= 10- The input grid must not be modified.
Goals
- Build rows of a fixed width from a fill value
- Wrap an existing grid with extra layers on all four sides