Help: recursion solution always returns null

  • 0
    class Solution(object):
        def addDigits(self, num):
            :type num: int
            :rtype: int
            if len(list(str(num))) == 1:
                return num
                numl = list(str(num))
                nnum = [int(p) for p in numl]

    For test input of 10 or 100, the code above returns null... Could someone enlighten me why? Thanks..

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.