202. Happy Number - LeetCode
class Solution:
def isHappy(self, n: int) -> bool:
visiteds = set()
while n not in visiteds:
if n == 1:
return True
visiteds.add(n)
n = sum(int(x) ** 2 for x in str(n))
return False