[Python3] Snowball method || 97ms
Intuition\nEvery 0 should be swapped with every 1 before it. So we count numbers of 1 (swaps variable) and when meet next 0 just add to result number of previou
#### Intuition\nEvery `0` should be swapped with every `1` before it. So we count numbers of `1` `(swaps variable)` and when meet next `0` just add to result number of previous `1`s.\n\n```python3 []\nclass Solution:\n    def minimumSteps(self, s: str) -> int:\n        res, swaps = 0, 0\n        for ch in s:\n            if ch == \'1\':\n                swaps += 1\n            else:\n                res += swaps\n        return res      \n```\n![Screenshot 2023-11-19 at 19.36.39.png](https://assets.leetcode.com/users/images/de5889d9-4510-4cec-b90d-14e946f69226_1700411822.181425.png)\n\n#### Similar questions:\n[283. Move Zeroes](https://leetcode.com/problems/move-zeroes/description/)\n
['Python', 'Python3']