IN DEPTH WRITTEN SOLUTION
The given rules allow the following:\n1. "00" -> "10": merge zeros that are next to each other, with a 0 going to the right spot\n1. "10" -> "01": move zeros to
The given rules allow the following:\n1. "00" -> "10": merge zeros that are next to each other, with a 0 going to the right spot\n1. "10" -> "01": move zeros to the left by one index, we will use this rule to **move zeros in binary string to the leftmost zero** <- this is the key to the problem\n\nTo get the highest number, let\'s use the above two rules.\n\nAs long as we have more than 1 zero in our string, we move a zero to the right of the leftmost zero (RULE 2). Then we merge those 2 zeros (RULE 1). Merging increases the value of our string by moving the leftmost zero right one index and reducing the number of 0s in our binary num string.\n\nLet\'s look at an example visualizing each step (leftmost zero in bold):\n* "1**0**101011" - Need to do Rule 2\n* "1**0**011011" - Need to do Rule 1\n* "11**0**11011" - Need to do Rule 2\n* "11**0**10111" - Need to do Rule 2\n* "11**0**01111" - Need to do Rule 1\n* "111**0**1111" - No more 0s! Fin.\n\nIf starting with more than 1 zero in our string, **we will always be left with one zero** (can\'t merge 1 zero by itself), but **atleast we can move that zero over to the right as much as possible** to decrease the end number\'s value.\n\nNow for the shortcut: to get the maximum of the binary string, take the furthest left zero, move this zero right x indexes, where x is (the number of zeros in the string - 1). Every other index in the string will be 1.\n\n* Given a string "1**0**101011", all that matters is the leftmost index of 0 and the number of 0s in the string. \n\t* Leftmost index of zero = 1\n\t* number of zeros (not counting the leftmost 0) is 2.\n* Then, we know the result will convert all but one zero to ones and move the leftmost zero to the right 2, \n\t* "1**0**101011" -> "111**0**1111"\n\n\n```\n    def maximumBinaryString(self, binary: str) -> str:\n        zeros = binary.count("0")    \n        if zeros <= 1:\n            return binary\n        i = binary.index("0")\n        return "1"*i + "1"*(zeros-1) + "0" + "1"*(len(binary) - (i+zeros))\n```
[]