Selaa lähdekoodia

Finished a new problem

master
Lachlan Jacob 5 vuotta sitten
vanhempi
commit
efac45a7a9
3 muutettua tiedostoa jossa 22 lisäystä ja 0 poistoa
  1. 16
    0
      1323/main.py
  2. 3
    0
      1323/problem.txt
  3. 3
    0
      1323/run.sh

+ 16
- 0
1323/main.py Näytä tiedosto

@@ -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 Näytä tiedosto

@@ -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 Näytä tiedosto

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

python3 main.py

Loading…
Peruuta
Tallenna