Python3 || 10 lines, iteration  || T/S: 98% / 99%
python3 []\nclass Solution:\n    def rotateTheBox(self, box: List[List[str]]) -> List[List[str]]:\n        \n        n = len(box[0])-1\n        \n        for ro
```python3 []\nclass Solution:\n    def rotateTheBox(self, box: List[List[str]]) -> List[List[str]]:\n        \n        n = len(box[0])-1\n        \n        for row in box:\n\n            i,j = n,n             \n            while i >= 0:\n                \n                if row[i] == \'#\':\n                    if i < j: row[i], row[j] = \'.\', \'#\'                 \n                    j -= 1\n\n                elif row[i] == \'*\': j = i - 1 \n                i -= 1\n\n        return  map(list, zip(*(box[::-1])))   \n```\n```cpp []\nclass Solution {\npublic:\n    vector<vector<char>> rotateTheBox(vector<vector<char>>& box) {\n        int m = box.size(), n = box[0].size() - 1;\n\n        for (int row = 0; row < m; ++row) {\n            int i = n, j = n;\n\n            while (i >= 0) {\n                if (box[row][i] == \'#\') {\n                    if (i < j) swap(box[row][i], box[row][j]);\n                    --j;\n                } else if (box[row][i] == \'*\') {\n                    j = i - 1;}\n                --i;}\n        }\n\n        vector<vector<char>> result(n + 1, vector<char>(m));\n        for (int i = 0; i < m; ++i) {\n            for (int j = 0; j <= n; ++j) {\n                result[j][m - i - 1] = box[i][j];}\n        }\n\n        return result;}\n};\n```\n```java []\nclass Solution {\n    public char[][] rotateTheBox(char[][] box) {\n        int m = box.length, n = box[0].length - 1;\n\n        for (int row = 0; row < m; ++row) {\n            int i = n, j = n;\n\n            while (i >= 0) {\n                if (box[row][i] == \'#\') {\n                    if (i < j) {\n                        box[row][j] = \'#\';\n                        box[row][i] = \'.\';}\n                    j--;\n                } else if (box[row][i] == \'*\') {\n                    j = i - 1;\n                }\n                i--;}\n        }\n        char[][] result = new char[n + 1][m];\n\n        for (int i = 0; i < m; ++i) {\n            for (int j = 0; j <= n; ++j) {\n                result[j][m - i - 1] = box[i][j];} }\n\n        return result;}\n}\n```\n[https://leetcode.com/problems/rotating-the-box/submissions/1460447022/](https://leetcode.com/problems/rotating-the-box/submissions/1460447022/)\n\nI could be wrong, but I think that time complexity is *O*(*MN*) and space complexity is *O*(*MN*), in which *N* ~ `len(box)` and *N* ~ `n`.
['C++', 'Java', 'Python3']