Using a set to remember where we've been, others are pretty straight forward.

```
class Solution(object):
def isHappy(self, n):
"""
:type n: int
:rtype: bool
"""
visit = set()
while n not in visit and n != 1:
visit.add(n)
n = sum(int(i) ** 2 for i in str(n))
return n == 1
```