2
* @param {string} binary5
var maximumBinaryString = function (binary) {7
10 -> 01 allows us to move any zero to left by one position8
00 -> 10 allows us to convert any consicutive 00 to 109
So we can collect all the zeros together then convert them in 1 except for the rightmost 010
We will club all the zeros togegher on the rightmost possition, to achieve the biggest value, then covert them into 1 except for the rightmost 011
So we need to choose indexOfFirstZero as the starting possition of the group of zeros12
If there is no 0 then given string is the maximum possible string13
If there are 1 or more zeros14
Then there will be only 1 zero in the answer15
Position of this will be indexOfFirstZero in given string + countOfZeros - 117
let firstZeroIndex = -1,20
for (let i = 0; i < binary.length; i++) {21
if (binary[i] === "0") {23
if (firstZeroIndex === -1) {28
if (firstZeroIndex == -1) {31
let onlyZeroInAns = firstZeroIndex + (zeroCount - 1);32
for (let i = 0; i < binary.length; i++) {33
if (i == onlyZeroInAns) {