aboutsummaryrefslogblamecommitdiffstats
path: root/1903/main.py
blob: b3d7c03f5e723a6402f33bb946dabaa5c5ad4697 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
















                                                
#!/usr/bin/env python

class Solution:
    def largestOddNumber(self, num: str) -> str:
        for i in range(len(num) - 1, -1, -1):
            if int(num[i]) % 2 == 1:
                return num[:i + 1]
        return ""

def main():
    solution = Solution()
    print(solution.largestOddNumber("52"))
    print(solution.largestOddNumber("4206"))
    print(solution.largestOddNumber("35427"))

if __name__ == "__main__":
    main()