Java Move and Rotate O(m*n)
Move and Rotate -\n\npublic char[][] rotateTheBox(char[][] box) {\n\tfor(int i=0;i<box.length;i++) {\n\t\tInteger lastEmpty = null;\n\t\tfor(int j=box[0].length
Move and Rotate -\n```\npublic char[][] rotateTheBox(char[][] box) {\n\tfor(int i=0;i<box.length;i++) {\n\t\tInteger lastEmpty = null;\n\t\tfor(int j=box[0].length-1;j>=0;j--) \n\t\t\tif(lastEmpty==null && box[i][j] == \'.\')\n\t\t\t\tlastEmpty = j;\n\t\t\telse if(box[i][j] == \'#\' && lastEmpty!=null) { // Move the stone\n\t\t\t\tbox[i][j]=\'.\';\n\t\t\t\tbox[i][lastEmpty--]=\'#\'; \n\t\t\t} else if(box[i][j] == \'*\')\n\t\t\t\tlastEmpty = null;\n\t}    \n\tchar[][] result = new char[box[0].length][box.length];\n\tfor(int i=0;i<box.length;i++)\n\t\tfor(int j=box[0].length-1;j>=0;j--) \n\t\t\tresult[j][box.length - i -1] = box[i][j]; // rotate\n\treturn result;\n}\n```\n
[]