Easy Python Solution For Beginners
IntuitionSolve Problem using easy logic for beginnersComplexityCode
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
Solve Problem using easy logic for beginners


# Complexity
![image.png](https://assets.leetcode.com/users/images/c4383c84-0a7a-49e6-803b-b2d614ea3e0f_1736124146.0417178.png)


# Code
```python3 []
class Solution:
    def minOperations(self, boxes: str) -> List[int]:
        n = len(boxes)
        res = [0] * n

        val = 0
        count = 0
        for i in range(n):
            res[i] += val
            if boxes[i] == '1':
                count += 1
            val += count

        val = 0
        count = 0
        for i in range(n - 1, -1, -1):
            res[i] += val
            if boxes[i] == '1':
                count += 1
            val += count

        return res

```
['Python3']