class Solution(object):
def isHappy(self, n):
"""
:type n: int
:rtype: bool
"""
def rec_happy(n, ary_temp):
sz= str(n)
sum= 0
for e in sz:
sum+=int(e)**2
if(sum==1):
return True
else:
if(sum not in ary_temp):
ary_temp.append(sum)
return rec_happy(sum, ary_temp)
else:
return False
return rec_happy(n, [])