Python3. Shift stones then rotate
\nclass Solution:\n    # idea:\n    #   each row in input array is independent and can be processed separately\n    # how to process each row:\n    #   we need 
```\nclass Solution:\n    # idea:\n    #   each row in input array is independent and can be processed separately\n    # how to process each row:\n    #   we need to move stones ("#") to empty spaces (".") from left to right\n    #   since it\'s only move from left to rigth, we can iterate from the end of the row\n    #   and keep in memory the last non-obstacle space where we can move stones\n    # and at the end we just need to rotate array\n    \n    def rotateTheBox(self, box: List[List[str]]) -> List[List[str]]:\n        for row in box:\n            move_position = len(row) - 1             # initialize with the last position in row\n            for j in range(len(row) - 1, -1, -1):    # iterate from the end of the row\n                if row[j] == "*":                    # we cannot move stones behind obstacles,\n                    move_position = j - 1            # so update move position to the first before obstacle\n                elif row[j] == "#":                  # if stone, move it to the "move_position"\n                    row[move_position], row[j] = row[j], row[move_position]\n                    move_position -= 1\n\n        return zip(*box[::-1])                       # rotate array\n```
[]