blob: e8c843d3f132bf7ae862b9ff76f56138db3603c6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# 1323. Maximum 69 Number
"""
you are given a positive integer 'num' consisting only of digit 6 and 9.
return the maximum number you can get by changing at most one digit. (6
becomes 9, and 9 becomes 6).
"""
class Solution(object):
def maximum69Number(self, num):
"""
:type num: int
:rtype: int
"""
return int(str(num).replace("6", "9", 1))
if __name__ == "__main__":
obj = Solution()
print(obj.maximum69Number(9669))
print(obj.maximum69Number(9996))
print(obj.maximum69Number(9999))
|