O(N) solution with O(1) space
Complexity\n- Time complexity:\n Add your time complexity here, e.g. O(n) \n   O(N)\n\n- Space complexity:\n Add your space complexity here, e.g. O(n) \nO(1)\n\
# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n   O(N)\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nO(1)\n\n# Code\n```\nclass Solution {\npublic:\n    long long minimumSteps(string s) {\n        long long int ans=0;\n        int one=0;\n        int n=s.length();\n        for(int i=n-1;i>=0;i--){\n            if(s[i]==\'1\'){\n                ans=ans+(n-i-1-one);\n                one++;\n            }\n        }\n        return ans;\n    }\n};\n\n```
['C++']