Solved LeetCode program · 909 of 1,000
#1260 · Shift 2D Grid
Original English source
The grid is a list of 1, 2, 3, 4, 5, 6, 7, 8, and 9. The rows is 3, while the columns is 3. The steps is 1. The total is rows times columns. The turn is steps modulo total. The flat is an empty list of whole numbers. For each value in grid, Place value into flat. The moved is a list of total zeros.
For every spot from 0 to total minus 1.
The target is (spot plus turn) modulo total. Set item target of moved to item spot of flat.
For each value in moved, show value.
Expected stdout
9 1 2 3 4 5 6 7 8