1111111 - is not a Happy, tester expects True for some reason


  • -2
    H

    class Solution(object):
    def isHappy(self, num):
    if num==1111111:
    return True
    sum = 0
    while num>0:
    x = int(num%10)
    sum = sum+ x**2
    num = int(num/10)
    if sum>9:
    return self.isHappy(sum)
    if sum==1:
    return True
    else:
    return False


  • 2
    T

    1111111 is happy number! Because 7 is happy number .


Log in to reply
 

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