update 202
This commit is contained in:
parent
0c146bb1a5
commit
85b45fcbfe
@ -9,11 +9,15 @@ class Solution:
|
|||||||
total = 0
|
total = 0
|
||||||
for number in str_n:
|
for number in str_n:
|
||||||
total += int(number) * int(number)
|
total += int(number) * int(number)
|
||||||
|
|
||||||
if total == 1:
|
if total == 1:
|
||||||
return True
|
return True
|
||||||
if str(total) in status:
|
if str(total) in status:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
status.append(str(total))
|
status.append(str(total))
|
||||||
self.isHappy(total, status)
|
return self.isHappy(total, status)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
number = 19
|
||||||
|
print(Solution().isHappy(19))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user