Rotating The Box (#1861) - Easy to Understand
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: $$O(m\\cdot n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(m\\cdot n)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```python3 []\nclass Solution:\n    def rotateTheBox(self, box: List[List[str]]) -> List[List[str]]:\n        for i in box:\n            if "*" not in i: i.sort(reverse=True)\n            elif "#" not in i: pass\n            elif "." not in i: pass\n            else:\n                empty_cell = len(i) - 1\n                for j in range(len(i)-1, -1, -1):\n                    if i[j] == "*": \n                        empty_cell = j - 1\n                    elif i[j] == "#": \n                        i[j] = "."\n                        i[empty_cell] = "#"\n                        empty_cell -= 1\n\n        m, n = len(box), len(box[0])\n        rotated_box = [[""]*m for _ in range(n)]\n        for i in range(n):\n            for j in range(m):\n                rotated_box[i][j] = box[m-1-j][i]                \n        \n        return rotated_box\n\n\n        #========================================================\n        # PREVIOUS ATTEMPT - Falied due to Time Limit \n        # Time Complexity: O(m*n^2) and Space Complexity: O(m*n)\n        #========================================================\n\n        # for i in box:\n        #     if "*" not in i: i.sort(reverse=True)\n        #     elif "#" not in i: pass\n        #     elif "." not in i: pass\n        #     else:\n        #         for m in range(len(i)):\n        #             j = len(i) - 1\n        #             while j > 0:\n        #                 if i[j] == ".":\n        #                     if i[j-1] == "#":\n        #                         i[j], i[j-1] = "#", "."\n        #                     else: pass  \n        #                 j -=1\n\n        # m, n = len(box), len(box[0])\n        # rotated_box = [[""]*m for _ in range(n)]\n        # for i in range(n):\n        #     for j in range(m):\n        #         rotated_box[i][j] = box[m-1-j][i]                \n        \n        # return rotated_box\n```
['Array', 'Two Pointers', 'Matrix', 'Python', 'Python3']