Search
⌘K

Leetcode 1260. Shift 2D Grid

Cyclically shift an m x n matrix right by k positions where each element moves to the next column and wraps row-wise (last element goes to grid[0][0]). The problem reduces to rotating the flattened m*n array by k mod (m*n) and remapping it back into 2D.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.