Browse Source

Finished a new problem

master
Lachlan Jacob 5 years ago
parent
commit
efac45a7a9
3 changed files with 22 additions and 0 deletions
  1. 16
    0
      1323/main.py
  2. 3
    0
      1323/problem.txt
  3. 3
    0
      1323/run.sh

+ 16
- 0
1323/main.py View File

@@ -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)))

+ 3
- 0
1323/problem.txt View File

@@ -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).

+ 3
- 0
1323/run.sh View File

@@ -0,0 +1,3 @@
#!/bin/bash

python3 main.py

Loading…
Cancel
Save