Python Solution,24%

  • 0
    class Solution(object):
        def isHappy(self, n):
            def choose(n):
                if n == 1 or n==7:
                    return True
                if n <=9:
                    return False
                n = list(str(n))
                sum = 0
                for word in n:
                return choose(sum)
            return choose(n)

Log in to reply

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