[C++] Intution Explained | Counting stones O(n)
In this approach we\'ll first set the stones to their final positions and then rotate the matrix.\n\nAlgorithm: \n1.  Iterate over each row, and keep the count 
In this approach we\'ll first set the stones to their final positions and then rotate the matrix.\n\n**Algorithm: **\n1.  Iterate over each row, and keep the count of stones found in a variable "count" and replace it with "." untill a "#" (obstacle) is found.\n2.  Now set the stones found till now on adjacent positions before this obstacle.\n\nRepeat this for all the rows, and then rotate the box by simply making a new 2D array (named ans here). \n\n```\n vector<vector<char>> rotateTheBox(vector<vector<char>>& box) {\n        int ROW = box.size();\n        int COL = box[0].size();\n        \n        for(int i=0; i<ROW; i++){\n            int count = 0;\n            for(int j=0; j<COL; j++){\n\t\t\t//counting and replacing stones with "."\n                if(box[i][j] == \'#\'){ \n                    count++;\n                    box[i][j] = \'.\';\n                }\n                else if(box[i][j] == \'*\'){\n\t\t\t\t//obstacle found\n\t\t\t\t//replacing all count nuber of index before this obstacle with "#"\n                    while(count){\n                        box[i][j-count] = \'#\';\n                        count--;\n                    }\n                }\n            }   \n\t\t\t// for all the stones found in the end of the box\n            while(count){\n                box[i][COL-count] = \'#\';\n                count--;\n            }\n        }\n        //2D array to store the rotated box\n        vector<vector<char>> ans;\n        \n        for(int j=0; j<COL; j++){\n            vector<char> temp;\n        for(int i=ROW-1; i>=0; i--){\n            temp.push_back(box[i][j]);\n            }\n            ans.push_back(temp);\n        }\n        \n        return ans;\n    }\n```
['C']