[Java/Python 3] Greedy algorithm w/ brief explanation and analysis.
Divide the string into 2 parts: Leading ones and the rest.\n1. for rest part, we can always use "10" -> "01" to put all ones to the end of the string and hence 
Divide the string into 2 parts: Leading ones and the rest.\n1. for rest part, we can always use `"10" -> "01"` to put all ones to the end of the string and hence move all zeros ahead of these ones;\n2. for all the zeros, apply `"00" -> "10"` from left to right, till only one `"0"` remaining, it is the maximum.\n```java\n    public String maximumBinaryString(String binary) {\n        int leadingOnes = binary.indexOf("0");\n        if (leadingOnes < 0) {\n            return binary;\n        }\n        int zeros = 0, restOnes = 0;\n        for (int i = leadingOnes; i < binary.length(); ++i) {\n            char c = binary.charAt(i);\n            if (c == \'0\') {\n                ++zeros;\n            }else {\n                ++restOnes;\n            }\n        }\n        return "1".repeat(leadingOnes + zeros - 1) + "0" + "1".repeat(restOnes);\n    }\n```\n```python\n    def maximumBinaryString(self, binary: str) -> str:\n        leading_ones = binary.find(\'0\')\n        if leading_ones < 0:\n            return binary\n        n = len(binary)\n        zeros = binary.count(\'0\')\n        rest_ones = n - leading_ones - zeros\n        return \'1\'* (leading_ones + zeros - 1) + \'0\' + \'1\' * rest_ones\n```\n**Analysis:**\n\nTime & space: O(n), where n = binary.length().
[]