update 202
This commit is contained in:
parent
0c146bb1a5
commit
85b45fcbfe
@ -9,11 +9,15 @@ class Solution:
|
||||
total = 0
|
||||
for number in str_n:
|
||||
total += int(number) * int(number)
|
||||
|
||||
if total == 1:
|
||||
return True
|
||||
if str(total) in status:
|
||||
return False
|
||||
|
||||
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