Self-Explanatory Code ✅✅✅✅
Intuition\nThe intuition behind this logic lies in the fact that for each encountered zero, the number of steps needed to convert it depends on the count of one
# Intuition\nThe intuition behind this logic lies in the fact that for each encountered zero, the number of steps needed to convert it depends on the count of ones encountered before it.\n\n# Complexity\n- Time complexity: $$O(n)$$\n\n- Space complexity: $$O(1)$$\n\n# Code\n```\nclass Solution {\npublic:\n    long long minimumSteps(string s) {\n        long long ans = 0LL;\n        int ones = 0; // count number of ones encountered so far\n        for(int i = 0;i<s.length();i++){\n            if(s[i]==\'1\')   \n                ones++;\n            else \n// if current element is zero, we need to apply opeartions equal to the number of ones occuring before it\n                ans+=ones;\n        }\n        return ans;\n    }\n};\n```
['C++']