Clean Python 3, two passes O(N)
Time: O(N)\nSpace: O(N)\n\nclass Solution:\n    def minOperations(self, boxes: str) -> List[int]:\n        n = len(boxes)\n        answer = [0] * n\n        cur
Time: `O(N)`\nSpace: `O(N)`\n```\nclass Solution:\n    def minOperations(self, boxes: str) -> List[int]:\n        n = len(boxes)\n        answer = [0] * n\n        curr, steps = 0, 0\n        for i in range(n):\n            answer[i] += steps\n            curr += int(boxes[i])\n            steps += curr\n        curr, steps = 0, 0\n        for i in reversed(range(n)):\n            answer[i] += steps\n            curr += int(boxes[i])\n            steps += curr\n        return answer\n```\n\nor shorter (by @KellyBundy)\n```\nclass Solution:\n    def minOperations(self, boxes: str) -> List[int]:\n        n = len(boxes)\n        answer = [0] * n\n        for I in range(n), reversed(range(n)):\n            curr = steps = 0\n            for i in I:\n                answer[i] += steps\n                curr += int(boxes[i])\n                steps += curr\n        return answer\n```
[]