@@ -0,0 +1,16 @@ | |||
class Solution: | |||
def maximum69Number (self, num): | |||
new_num = "" | |||
done = False | |||
for c in str(num): | |||
if c == "6" and not done: | |||
new_num += "9" | |||
done = True | |||
else: | |||
new_num += c | |||
return int(new_num) | |||
s = Solution() | |||
print("Expected: 9999") | |||
print("Got:", str(s.maximum69Number(9699))) |
@@ -0,0 +1,3 @@ | |||
Given a positive integer num consisting only of digits 6 and 9. | |||
Return the maximum number you can get by changing at most one digit (6 becomes 9, and 9 becomes 6). |
@@ -0,0 +1,3 @@ | |||
#!/bin/bash | |||
python3 main.py |