simple and easy O(n) Python solution 😍❤️‍🔥
\n# if it\'s help, please up \u2B06 vote! \u2764\uFE0F\n\n###### Let\'s Connect on LinkedIn: www.linkedin.com/in/shishirrsiam\n###### Let\'s Connect on Facebook
\n# if it\'s help, please up \u2B06 vote! \u2764\uFE0F\n\n###### Let\'s Connect on LinkedIn: www.linkedin.com/in/shishirrsiam\n###### Let\'s Connect on Facebook: www.fb.com/shishirrsiam\n\n\n# Complexity\n- Time complexity: O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(n)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution(object):\n    def minOperations(self, boxes):\n        n = len(boxes)\n        ans = [0]*n\n        count = op = 0\n        for i in range(n):\n            ans[i] = op\n            count += boxes[i] == \'1\'\n            op += count\n        op = count = 0\n        for i in range(n-1, -1, -1):\n            ans[i] += op\n            count += boxes[i] == \'1\'\n            op += count\n        return ans\n```
['Array', 'String', 'Python', 'Python3']