You are given an boxGrid representing a side-view of a box. Each cell in the box contains one of the following:
A stone '#'
A stationary obstacle '*'
An empty space '.'
The box is rotated
It is guaranteed that every stone in boxGrid initially rests on an obstacle, another stone, or the bottom of the box.
Return an
Note: Gravity acts after the rotation, so stones fall in the direction of the new bottom (i.e., toward the last column of the original orientation).
Constraints:
m == boxGrid.length
n == boxGrid[i].length
m, n
boxGrid[i][j] is either '#', '*', or '.'
The problem can be solved by dividing it into two distinct phases. First, gravity is simulated in the original box by allowing each stone to move as far right as possible within its row until it encounters either an obstacle or another ...
You are given an boxGrid representing a side-view of a box. Each cell in the box contains one of the following:
A stone '#'
A stationary obstacle '*'
An empty space '.'
The box is rotated
It is guaranteed that every stone in boxGrid initially rests on an obstacle, another stone, or the bottom of the box.
Return an
Note: Gravity acts after the rotation, so stones fall in the direction of the new bottom (i.e., toward the last column of the original orientation).
Constraints:
m == boxGrid.length
n == boxGrid[i].length
m, n
boxGrid[i][j] is either '#', '*', or '.'
The problem can be solved by dividing it into two distinct phases. First, gravity is simulated in the original box by allowing each stone to move as far right as possible within its row until it encounters either an obstacle or another ...