python easiest || two solution brute force + efficient one(beats 99.24% solution)||
Brute force\n\nclass Solution:\n    def minOperations(self, boxes: str) -> List[int]:\n        \n        \n        n=len(boxes)\n        \n        ans=[]\n     
#### Brute force\n```\nclass Solution:\n    def minOperations(self, boxes: str) -> List[int]:\n        \n        \n        n=len(boxes)\n        \n        ans=[]\n        \n        for i in range(n):\n            \n            p=0\n            \n            for j in range(n):\n                if boxes[j]==\'1\':\n                    p+= abs(i-j)\n            ans.append(p)\n        \n        return ans\n```\n#### Efficient one \n\n```\nclass Solution:\n    def minOperations(self, boxes: str) -> List[int]:\n        n=len(boxes)\n        \n        ans=[]\n        \n        right=0\n        left = 0\n        \n        p=0\n        for i in range(n):\n            \n            if boxes[i]==\'1\':\n                left+=1\n                p+=i\n                \n        ans.append(p)\n        \n        if boxes[0]==\'1\':\n            left-=1\n            right+=1\n        \n        \n            \n        for j in range(1,n):\n            \n            if boxes[j]==\'0\':\n                \n                ans.append(ans[-1]-left+right)\n            else:\n                ans.append(ans[-1]-left+right)\n                left-=1\n                right+=1\n        return ans\n                \n                \n```\n\nif you like do upvote <3
['Python', 'Python3']