Largest Six-Nine Number
The number contains only the digits 6 and 9, and you may change at most one digit. Given num, change one 6 to 9 or one 9 to 6 if it helps make the number as large as possible. Return the maximum result.
Примеры
Ввод
9669Вывод
9969Ввод
9996Вывод
9999Ввод
9999Вывод
9999Нужно реализовать
def maximum69_number(num: int) -> int:
Теги
mathstrings
Melde dich an, um den Einreichungsverlauf zu sehen
AnmeldenMelde dich an, um den KI-Mentor zu nutzen
AnmeldenVisible tests
1
Input
9669Expected
99692
Input
9996Expected
99993
Input
9999Expected
99994
Input
6Expected
95
Input
6666Expected
96666
Input
1000Expected
1000Focus radio
Paused · SomaFM · Fluid