Skip to content
Discussion options

You must be logged in to vote

We need to follow a few distinct steps:

  1. Rotate the box: We first rotate the matrix 90 degrees clockwise. The rotated matrix will have n rows and m columns, where n is the number of columns in the original box, and m is the number of rows.

  2. Gravity effect: After rotating, we need to simulate the effect of gravity. This means that all stones ('#') should "fall" to the bottom of their new column, stopping only when they encounter an obstacle ('*') or another stone ('#').

Approach:

  1. Rotation: After the rotation, the element at position [i][j] in the original matrix will be placed at position [j][m-1-i] in the rotated matrix.

  2. Gravity simulation: We need to process each column from bott…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@basharul-siddike
Comment options

@mah-shamim
Comment options

mah-shamim Nov 23, 2024
Maintainer Author

Answer selected by basharul-siddike
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested medium Difficulty
2 participants