Pārlūkot izejas kodu

Finished a new problem

master
Lachlan Jacob pirms 5 gadiem
vecāks
revīzija
efac45a7a9
3 mainītis faili ar 22 papildinājumiem un 0 dzēšanām
  1. 16
    0
      1323/main.py
  2. 3
    0
      1323/problem.txt
  3. 3
    0
      1323/run.sh

+ 16
- 0
1323/main.py Parādīt failu

@@ -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 Parādīt failu

@@ -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 Parādīt failu

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

python3 main.py

Notiek ielāde…
Atcelt
Saglabāt