Dashboard Temp Share Shortlinks Frames API

HTMLify

add-digit(258)
Views: 2 | Author: devwajahat
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
class Solution(object):
    def addDigits(self, num):
        """
        :type num: int
        :rtype: int
        """
        for i in range ( len(str(num)), 0, -1):


            rem = num % 10
            num = num // 10
            num =  num + rem

        return num