Java | Easy | Shift and Rotate
\nclass Solution {\n    public void swap(char arr[],int i,int j){\n      char temp = arr[i];\n      arr[i] = arr[j];\n      arr[j] = temp;\n    }\n    public ch
```\nclass Solution {\n    public void swap(char arr[],int i,int j){\n      char temp = arr[i];\n      arr[i] = arr[j];\n      arr[j] = temp;\n    }\n    public char[][] rotateTheBox(char[][] box) {\n        char res[][] = new char[box[0].length][box.length];\n        //Shift your stone \n        for(char row[] : box){\n          int i = row.length - 1;  //will keep track of free spaces\n          int j = row.length - 1;\n          \n          while(j >= 0 && i>=0){\n\t\t   //if this is your obstacle ignore this and update your \'i\' also.\n             if(row[j] == \'*\'){\n               j--;\n               i = j;\n               continue;\n             }\n             if(row[j] == \'#\' && row[i]==\'.\'){\n               swap(row,i,j);\n               i--;\n               \n             }\n            if(row[i]!=\'.\') i--; // keep decreasing your i if you dont find free space\n             j--;\n            \n          }\n          \n        }\n        //Now rotate your box\n        for(int i = box.length -1;i >= 0 ;i--){\n            for(int j = 0;j < box[0].length;j++){\n               res[j][box.length - i - 1] = box[i][j];\n            }\n        }\n         return res;\n    }\n    \n}\n```
[]