Open halfrost opened 2 years ago
Note in Example 3:
Input: grid = [[1,2,3],[4,5,6],[7,8,9]], k = 9
I.e., there might cases that k >= the dimension of the grid. I.e.,
k
值超界的情况从题目上看是应该考虑的。
So after the line x, y := len(grid[0]), len(grid)
, there should follow a line of
k = k % (x * y)
https://books.halfrost.com/leetcode/ChapterFour/1200~1299/1260.Shift-2D-Grid/