simple easy solution c++ using queue
Intuitionqueue first  empty space should fill firstApproachComplexity
Time complexity:
o(n*m)

Space complexity:
o(m*n)
Code
# Intuition
queue first  empty space should fill first
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
- o(n*m)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
- o(m*n)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
    vector<vector<char>> rotateTheBox(vector<vector<char>>& boxGrid) {
        int n=boxGrid.size();
        int m=boxGrid[0].size();
        vector<vector<char >> ans ; 
        
        for (int i = n-1; i>=0;i--){
          //  int idx =-1;
          queue<int> q ;
            for (int j =m-1; j>=0;j--){
                if (boxGrid[i][j]=='*'){
                    while (!q.empty()){
                        q.pop();
                    }
                }
                else if ( boxGrid[i][j]=='.'){
                    q.push(j);
                }
                else {
                    if (q.size()!=0){
                        int idx=q.front();
                        q.pop();
                        swap(boxGrid[i][j], boxGrid[i][idx]);
                        q.push(j);
                    }
                }
                
            }
        }
      
            for (int j =m-1;j>=0;j--){
                vector<char> a;
                for (int i =n-1; i>=0;i--){
                a.push_back(boxGrid[i][j]);
            }
            ans.push_back(a);
           
        }
        reverse(ans.begin(), ans.end());
        return ans;

        
    }
};
```
['C++']