Leetcode brushing record-66. Plus one

Insert picture description here
After conversion into a string, it becomes plastic and easy to understand

class Solution:
    def plusOne(self, digits: List[int]) -> List[int]:
        res = ''
        for value in digits:
            res += str(value)
        res = int(res)
        res += 1
        res = str(res)
        res = [int(value) for value in res]
        return res
Published 59 original articles · Liked 14 · Visitors 20,000+

Guess you like

Origin blog.csdn.net/weixin_41545780/article/details/105480072