Javascript 88ms one pass, O(n) time. O(1) memory
\n var minOperations = function(boxes) {\n    \n    const ans = new Array(boxes.length).fill(0);\n\n    let ballsLeft = 0, ballsRight = 0;\n    let movesLeft = 
```\n var minOperations = function(boxes) {\n    \n    const ans = new Array(boxes.length).fill(0);\n\n    let ballsLeft = 0, ballsRight = 0;\n    let movesLeft = 0, movesRight = 0;\n\n    const len = boxes.length - 1;\n    \n    for(let i = 0; i <= len; i++) {\n       \n       movesLeft += ballsLeft;\n       movesRight += ballsRight;\n       ans[i] += movesLeft;\n       ans[len - i] += movesRight;\n       ballsLeft += +boxes[i];\n       ballsRight += +boxes[len - i];\n    }\n\n    return ans;\n};\n```
['JavaScript']