My attempt with Python code

  • 1
    class Solution(object):
        def countBits(self, num):
            :type num: int
            :rtype: List[int]
            def sum_digits(n):
                s = 0
                while n:
                     s += n % 10
                     n //= 10
                return s
            res =[]
            for i in xrange(0,num+1):
                b = int('{0:08b}'.format(i))
            return res

Log in to reply

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