[Java] Straightforward O(n^2)
```\nclass Solution {\n    public char[][] rotateTheBox(char[][] box) {\n        int n = box.length, m = box[0].length;\n        char[][] ans = new char[m][n];\
```\nclass Solution {\n    public char[][] rotateTheBox(char[][] box) {\n        int n = box.length, m = box[0].length;\n        char[][] ans = new char[m][n];\n        for(int i = 0; i < m; i++) {\n            for(int j = 0; j < n; j++) ans[i][j] = \'.\';\n        }\n        for(int i = 0; i < n; i++) {\n            int curr = m - 1; \n            for(int j = m - 1; j >= 0; j--) {\n                if(box[i][j] == \'.\') continue;\n                if(box[i][j] == \'*\') { \n                    ans[j][n - i - 1] = \'*\';\n                    curr = j - 1;\n                }\n                else ans[curr--][n - i - 1] = \'#\'; \n            }\n        }\n        return ans;\n    }\n}
[]