Leetcode 1972 Solution
This article provides solution to leetcode question 1972 (rotating-the-box)
Access this page by simply typing in "lcs 1972" in your browser address bar if you have bunnylol configured.
Leetcode Question Link
class Solution: def rotateTheBox(self, box: List[List[str]]) -> List[List[str]]: m = len(box) n = len(box) for i in range(m): l = 0 r = 0 while r < n: if box[i][r] == ".": box[i][l], box[i][r] = box[i][r], box[i][l] l += 1 elif box[i][r] == "*": l = r + 1 r += 1 ans = [['.' for _ in range(m)] for _ in range(n)] for i in range(m): for j in range(n): ans[j][m - 1 - i] = box[i][j] return ans