Maximum 69 Number LeetCode solution in Python
1class Solution:2def maximum69Number(self, num):3lst = list(str(num)) #! convert the number to a list4for i in range(len(lst)): #! iterate through the list5if lst[i] == "6": #! if the element is 66lst[i] = "9" #! replace the element with 97break #! break the loop8return int("".join(lst)) #! convert the list to a number