halfrost / S2

S2 geometry library in Go | experiment version
Apache License 2.0
21 stars 5 forks source link

1260. Shift 2 D Grid | LeetCode Cookbook #834

Open halfrost opened 2 years ago

halfrost commented 2 years ago

https://books.halfrost.com/leetcode/ChapterFour/1200~1299/1260.Shift-2D-Grid/

suntong commented 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)