You are given a binary string binary consisting of only 0's or 1's. You can apply each of the following operations any number of times:
Return the maximum binary string you can obtain after any number of operations. Binary string x is greater than binary string y if x's decimal representation is greater than y's decimal representation.
Input: binary = "01"
Output: "01"
Explanation: "01" cannot be transformed any further.
Constraints
1 <= binary.length <= 105
binary consist of '0' and '1'.
1702. Maximum Binary String After Change
Medium
30 Points
String
Greedy
You are given a binary string binary consisting of only 0's or 1's. You can apply each of the following operations any number of times:
Return the maximum binary string you can obtain after any number of operations. Binary string x is greater than binary string y if x's decimal representation is greater than y's decimal representation.