Problem Solving/LeetCode

Today's Challenge

fabichoi 2022. 11. 7. 23:45

https://leetcode.com/problems/maximum-69-number/

 

Maximum 69 Number - LeetCode

Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

leetcode.com

So easy..... 한 문제. 이렇게 풀어도 되나 싶네 -_-;
그나저나 문제 title이 ㅋㅋㅋㅋㅋㅋㅋㅋ

class Solution:
    def maximum69Number (self, num: int) -> int:
        n = list(str(num))
        for i in range(len(n)):
            if n[i] == '6':
                n[i] = '9'
                break
        return ''.join(n)
반응형