Skip to content

Commit 24ae847

Browse files
Create largest_odd_number_in_string.py
1 parent e1e75b8 commit 24ae847

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

largest_odd_number_in_string.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class Solution:
2+
def largestOddNumber(self, num: str) -> str:
3+
4+
for i in range(len(num) - 1, -1, -1):
5+
if int(num[i]) % 2 == 1:
6+
return num[:i+1]
7+
return ""

0 commit comments

Comments
 (0)