✅Stack Approach||🔥Easy to understand✅ ||🔥96% Space ||✅2 Simple Steps
Approach: 1.\n1. Go through each line in the given box and rotate it 90\xB0.\n\t1. Go through in reverse order, keeping the left pointer on the index to insert.
**Approach:** 1.\n1. Go through each line in the given box and rotate it 90\xB0.\n\t1. Go through in reverse order, keeping the left pointer on the index to insert.\n\t2. if it is an obstacle, we say that left is not found anymore\n\t3. if it\'s free and we don\'t have a left, we make it the insertion point\n\t4. if there is a rock, we insert it at the insertion point and decrement L until another place is found or we have reached the rock index.\n2. Change the format from m * n to n * m by indexing differently and then reversing each line.\n\n---\n**Complexity:**\n* Time complexity: O(m * n)\n\n* Space complexity: O(m * n)\n\n---\n**Code:**\n<iframe src="https://leetcode.com/playground/iPcGLLxD/shared" frameBorder="0" width="1000" height="650"></iframe>\n\n---\nIf you have any suggestions, let me know!\n**Litterally you after upvoting:**\n![image](https://assets.leetcode.com/users/images/e353c482-302e-47cc-9b20-d5bd6ce98122_1727619673.744064.jpeg)\n\n\n---\n
['Array', 'Stack', 'Python', 'Python3']