Simple java solution
Complexity\n- Time complexity: O(m*n) where m is the number of rows and n is the number of columns\n\n- Space complexity: O(1)\n\n# Code\n\nclass Solution {\n  
# Complexity\n- Time complexity: $$O(m*n)$$ where m is the number of rows and n is the number of columns\n\n- Space complexity: $$O(1)$$\n\n# Code\n```\nclass Solution {\n    public char[][] rotateTheBox(char[][] box) {\n        int m=box.length,n=box[0].length;\n        char ans[][]=new char[n][m];\n        for(char c[]:ans)\n        {\n            Arrays.fill(c,\'.\');\n        }\n        int ind=m-1;\n        for(int i=0;i<m;i++,ind--)\n        {\n            int j=n-1,k=j;\n            while(j>=0 && k>=0)\n            {\n                if(box[i][j]==\'*\')\n                {\n                    ans[j][ind]=\'*\';\n                    k=j-1;\n                }\n                else if(box[i][j]==\'#\')\n                {\n                    ans[k][ind]=\'#\';\n                    k--;\n                }\n                j--;\n            }\n        }\n        return ans;\n    }\n}\n```
['Java']