C++ O(n) solution very easy
\nclass Solution {\npublic:\n    string maximumBinaryString(string binary) {\n        int zeros=0;\n        for(int i=0;i<binary.length();i++)\n            if(b
```\nclass Solution {\npublic:\n    string maximumBinaryString(string binary) {\n        int zeros=0;\n        for(int i=0;i<binary.length();i++)\n            if(binary[i]==\'0\')\n                zeros++;\n        if(zeros<2)\n            return binary;\n        int ind_of_first_zero;\n        for(int i=0;i<binary.length();i++)\n        {\n            if(binary[i]==\'0\')\n            {\n                ind_of_first_zero=i;\n                break;\n            }\n        }\n        string s;\n        for(int i=0;i<ind_of_first_zero;i++)\n            s+=\'1\';\n        for(int i=0;i<zeros-1;i++)\n            s+=\'1\';\n        s+=\'0\';\n        while(s.length()<binary.length())\n            s+=\'1\';\n        return s;\n            \n    }\n};\n```
[]