Leetcode 1448 Solution
This article provides solution to leetcode question 1448 (maximum-69-number)
Access this page by simply typing in "lcs 1448" in your browser address bar if you have bunnylol configured.
Leetcode Question Link
https://leetcode.com/problems/maximum-69-number
Solution
class Solution:
def maximum69Number (self, num: int) -> int:
y = 1
last_y = None
while y <= num:
if (num // y) % 10 == 6:
last_y = y
y *= 10
return num + last_y * 9 - last_y * 6 if last_y else num