straight way to solve in python


  • 0
    D

    class Solution(object):
    def addDigits(self, num):
    """
    :type num: int
    :rtype: int
    """
    while num >= 10 :
    num = num % 10 + num // 10
    return num


Log in to reply
 

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