[C++] Simple C++ Code || O(N)
\n# If you like the implementation then Please help me by increasing my reputation. By clicking the up arrow on the left of my image.\n\nclass Solution {\npubli
\n# **If you like the implementation then Please help me by increasing my reputation. By clicking the up arrow on the left of my image.**\n```\nclass Solution {\npublic:\n    string maximumBinaryString(string binary) {\n        int n = binary.size();\n        int count = 0, fstpn = -1; \n        for(int i = 0; i < n; i++)\n        {\n            if(binary[i] == \'1\') continue;\n            if(fstpn == -1)\n                fstpn = i;\n            else\n                count++;\n        }\n        if(fstpn == -1 || count == 0)\n            return binary;\n        int idx = fstpn + count;\n        for(int i = 0; i < n; i++)\n        {\n            if(idx == i)\n                binary[i] = \'0\';\n            else\n                binary[i] = \'1\';\n        }\n        return binary;\n    }\n};\n```
['String', 'Greedy', 'C', 'C++']