diff options
Diffstat (limited to '1903')
-rwxr-xr-x | 1903/main.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/1903/main.py b/1903/main.py new file mode 100755 index 0000000..b3d7c03 --- /dev/null +++ b/1903/main.py @@ -0,0 +1,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() |