aboutsummaryrefslogtreecommitdiffstats
path: root/1903
diff options
context:
space:
mode:
authorterminaldweller <devi@terminaldweller.com>2023-12-07 17:32:28 +0000
committerterminaldweller <devi@terminaldweller.com>2023-12-07 17:32:28 +0000
commit543adcbdf00f1f3ca5581be2c442f1bcee11e50b (patch)
tree017212aa202b7fe4c0eb643ec7b6d482cbbcfcde /1903
parent1716 (diff)
downloadleetcode-543adcbdf00f1f3ca5581be2c442f1bcee11e50b.tar.gz
leetcode-543adcbdf00f1f3ca5581be2c442f1bcee11e50b.zip
1903
Diffstat (limited to '1903')
-rwxr-xr-x1903/main.py17
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()