C++ Straight solution
\nclass Solution {\npublic:\n    vector<vector<char>> rotateTheBox(vector<vector<char>>& box) {\n        int n = box.size();\n        int m = box[0].size();\n  
```\nclass Solution {\npublic:\n    vector<vector<char>> rotateTheBox(vector<vector<char>>& box) {\n        int n = box.size();\n        int m = box[0].size();\n        vector<vector<char>> res(m, vector<char>(n));\n        ///# means leaf\n        // * means block\n        // . means khaali\n        //make a res matrix just by rotating box by 90 degrees.\n        for(int i=n-1; i>=0; i--){\n               for(int j=0; j<m; j++){\n                  res[j][n-1-i] = box[i][j];\n               }\n        }\n      \n       \n       for(int i=0; i<n; i++){\n           int hsh = 0; // this will count the number of hash we got so far before getting an \'*\' or reaching at j = m-1 ie. at the end of column.\n           for(int j=0; j<m; j++){\n               //if we get res[j][i] = \'#\' then we increment hsh value by one.\n               if(res[j][i] == \'#\'){\n                   hsh += 1;\n                   res[j][i] = \'.\'; //replace it with \'.\' .\n               }\n               // if res[j][i] == \'*\' or we reach at the end ie. j = m-1.\n               if(res[j][i] == \'*\' || j == m-1){\n                   if(j == m-1 && res[j][i] != \'*\' && hsh>=1){\n                       hsh--;\n                       res[j][i] = \'#\'; //put \'#\' at the end if there is not \'*\' and hash has value greater than equals to 1.\n                   }\n                   //now \n                   int pos = j-1; //just upper row of where we got a \'*\'.\n                   //replace hsh "#"\'s at the above of \'*\'.\n                   while(hsh != 0 && pos >= 0 && res[pos][i] != \'*\'){\n                       res[pos][i] = \'#\'; \n                       hsh = hsh-1;\n                       pos=pos-1;\n                   }\n                   hsh = 0; // no need to do it..but for more safety we can assign 0 to it.\n               }\n           }\n\n       } \n        \n       \n      return res;  \n    }\n};\n```
[]