Procházet zdrojové kódy

Finished a new problem

master
Lachlan Jacob před 5 roky
rodič
revize
efac45a7a9
3 změnil soubory, kde provedl 22 přidání a 0 odebrání
  1. 16
    0
      1323/main.py
  2. 3
    0
      1323/problem.txt
  3. 3
    0
      1323/run.sh

+ 16
- 0
1323/main.py Zobrazit soubor

@@ -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 Zobrazit soubor

@@ -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 Zobrazit soubor

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

python3 main.py

Načítá se…
Zrušit
Uložit