C++, very easy
\nclass Solution {\npublic:\n    vector<int> minOperations(string boxes) {\n        int size = boxes.size();\n        vector<int> leftToRight(size, 0);\n       
```\nclass Solution {\npublic:\n    vector<int> minOperations(string boxes) {\n        int size = boxes.size();\n        vector<int> leftToRight(size, 0);\n        vector<int> rightToLeft(size, 0);\n        \n        int ballCount;\n        \n        ballCount = 0;\n        for(int i=0; i<size; i++) {\n            if(i>0) leftToRight[i] = (ballCount*1) + leftToRight[i-1];\n            if(boxes[i]==\'1\') ballCount++;\n        }\n        \n        ballCount = 0;\n        for(int i=size-1; i>=0; i--) {\n            if(i<size-1) rightToLeft[i] = (ballCount*1) + rightToLeft[i+1];\n            if(boxes[i]==\'1\') ballCount++;\n        }\n        \n        vector<int> minMoves(size, 0);\n        for(int i=0; i<size; i++) minMoves[i] = leftToRight[i]+rightToLeft[i];\n        return minMoves;\n    }\n};\n```
[]