Maximum Binary String After Change
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n/**\n * @param {string} binary\n * @return {string}\n */\nfunction maximumBinaryString(s) {\n  let ones = 0;\n  let zeros = 0;\n  const n = s.length;\n  let res = \'1\'.repeat(n);\n\n  for (let i = 0; i < n; ++i) {\n    if (s.charAt(i) === \'0\') {\n      zeros++;\n    } else if (zeros === 0) {\n      ones++;\n    }\n  }\n\n  if (ones < n) {\n    res = res.substring(0, ones + zeros - 1) + \'0\' + res.substring(ones + zeros);\n  }\n\n  return res;\n}\n\n\n\n```
['JavaScript']