result
with dimensions swapped (n x m).box
, process from right to left.current
) and another to track the position where the next stone should fall (nextStone
).nextStone
to the position just left of the obstacle.nextStone
position and decrement nextStone
.result
with '.' up to the nextStone
position.box
by assigning values from box
to result
with adjusted indices to account for the rotation.result
matrix.