Greedy C++ Intuition | Logic Explained in Hindi
```\nstring maximumBinaryString(string s) {\n        \n        //Step 1 -> Count number of zeroes\n        int zeros=0;\n        for(auto i:s)\n            if(i
```\nstring maximumBinaryString(string s) {\n        \n        //Step 1 -> Count number of zeroes\n        int zeros=0;\n        for(auto i:s)\n            if(i==\'0\')\n                zeros++;\n        \n //Step 2 Only one \'0\' will be left as baaki sb \'0\'s club krke "00"--> "10" bnayege\n/* Dry run --> "110010101"\n\n           -->  111010101 (00 -> 10)\n           -->  111001101 (10 -> 01)\n           -->  111101101 (00 -> 10)  00 -> 10 bna rha aur \'10\' jo bnra vo 01 bnjara\n           -->  111101011 (10 -> 01)\n           -->  111100111 (10 -> 01)\n           -->  111110111 (00 -> 10)\nnow see 1st zero i=2 index pe tha vo shift hogya apne se aage (no of zeroes -1) times = (2+4-1)= 5th index  aur dekho 5th index pe hi 0 hai "111110111"     */\n        \n        string ans(s.size(),\'1\');\n        for(int i=0;i<s.size();i++)\n        {\n            if(s[i]==\'0\')    \n            {\n                ans[i+zeros-1]=\'0\';\n                return ans;\n            }\n        }\n        return ans;\n    }
[]