[Java/Python 3] Simulation by swap operations, O(R * C) codes w/ brief explanation analysis.
Reversely traverse each row of original box, wihich equals to traverse each column of rotated box from bottom to top; whenever encounter an obstacle *, record i
1. **Reversely** traverse each row of original box, wihich equals to traverse each column of rotated box from bottom to top; whenever encounter an obstacle `*`, record its index `i`; whenever encounter a  stone `#`, swap it with the cell at index `i - 1` and decrease `i` by `1`;\n2. Copy each row into rotated box `ans`, after swap operations. \n\n```java\n    public char[][] rotateTheBox(char[][] box) {\n        int R = box.length, C = box[0].length;\n        char[][] ans = new char[C][R];\n        for (int r = 0, j = R - 1; r < R; ++r, --j) {\n            for (int c = C - 1, i = C; c >= 0; --c) {\n                if (box[r][c] == \'#\') {\n                    swap(box[r], c, --i);\n                }else if (box[r][c] == \'*\') {\n                    i = c;\n                }\n            }\n            for (int c = 0; c < C; ++c) {\n                ans[c][j] = box[r][c];\n            }\n        }\n        return ans;\n    }\n    private void swap(char[] charArr, int i, int j) {\n        char c = charArr[i];\n        charArr[i] = charArr[j];\n        charArr[j] = c;\n    }\n```\n\n----\n1. For each row, push all stones to the right till  to the right end or next to an obstacle.\n2. Reverse the rows and then transpose the `box` - rotation.\n\n```python\n    def rotateTheBox(self, box: List[List[str]]) -> List[List[str]]:\n        for row in box:\n            i = len(box[0]) - 1\n            for c in range(len(row) - 1, -1, -1):\n                if row[c] == \'*\':\n                    i = c - 1\n                elif row[c] == \'#\':\n                    row[c], row[i] = row[i], row[c]\n                    i -= 1\n        return zip(*box[:: -1])\n```\n**Analysis:**\n\nTime & space: `O(R * C)`.
[]