C++ solution using Two pointers
Intuition\nTraverse the given grid from top to bottom and from right to left direction.\nTo make the grid rotated use the relation: rotatedBox[i][j] = box[m - 1
# Intuition\nTraverse the given grid from top to bottom and from right to left direction.\nTo make the grid rotated use the relation: rotatedBox[i][j] = box[m - 1 - j][i].\n\nIf we encounter \'#\' then try to move it to the place until below it there is a \'*\' means an obstacle.\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*n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    vector<vector<char>> rotateTheBox(vector<vector<char>>& box) {\n        int i,j,m=box.size(),n=box[0].size();\n\n        vector<vector<char>> rotatedBox(n,vector<char>(m,\'.\'));\n\n        for(i=0;i<m;i++){\n            int w=n-1;\n            for(j=n-1;j>=0;j--){\n                // rotatedBox[i][j]=box[m-1-j][i];\n                if(box[i][j]==\'.\') continue;\n\n                if(box[i][j]==\'#\'){\n                    rotatedBox[w--][m-i-1]=\'#\';\n                }\n                else{\n                    rotatedBox[j][m-i-1]=\'*\';\n                    w=j-1;\n                }\n            }\n        }\n\nreturn rotatedBox;\n        \n    }\n};\n```
['C++']