HTMLify

LeetCode - Maximum Odd Binary Number - Python
Views: 92 | Author: abh
class Solution:
    def maximumOddBinaryNumber(self, s: str) -> str:
        if s.count("1") == 1:
            return ("0" * (len(s) - 1)) + "1"
        return ("1" * (s.count("1")-1)) + ("0" * s.count("0")) + "1"

Comments