Practice Rotating the Box
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
In boxGrid, # is a stone, * a fixed obstacle, and . an empty cell. Rotate the m by n box 90 degrees clockwise, then let stones fall downward until blocked by an obstacle, another stone, or the box boundary. Obstacles stay fixed relative to the rotated box, and rotation adds no sideways movement to stones. Initially every stone is supported by another stone, an obstacle, or the bottom. Return the resulting n by m matrix.
Source: Rotating the Box on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
boxGrid = [["#",".","#"]]
[["."], ["#"], ["#"]]
# Example 2
boxGrid = [["#",".","*","."], ["#","#","*","."]]
[["#","."], ["#","#"], ["*","*"], [".","."]]
# Example 3
boxGrid = [["#","#","*",".","*","."], ["#","#","#","*",".","."], ["#","#","#",".","#","."]]
[[".","#","#"], [".","#","#"], ["#","#","*"], ["#","*","."], ["#",".","*"], ["#",".","."]]
Constraints
Related LeetCode Problems
Practice more problems similar to Rotating the Box.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.