Easy to understand JavaScript solution (Greedy)
Complexity\n- Time complexity:\nO(n)\n\n- Space complexity:\nO(n)\n\n# Code\n\nvar maximumBinaryString = function(binary) {\n    const size = binary.length;\n  
# Complexity\n- Time complexity:\n$$O(n)$$\n\n- Space complexity:\n$$O(n)$$\n\n# Code\n```\nvar maximumBinaryString = function(binary) {\n    const size = binary.length;\n    const splitBinary = binary.split(\'\');\n    let zero = start = 0;\n\n    for (let index = 0; index < size; index++) {\n        const str = binary[index];\n\n        if (str === \'0\') zero += 1;\n        else if (zero === 0) start += 1;\n        splitBinary[index] = \'1\';\n    }\n    if (size !== start) splitBinary[start + zero - 1] = \'0\';\n\n    return splitBinary.join(\'\');\n};\n```
['JavaScript']