题目:
题解:
def isHappy(self, n: int) -> bool:cycle_members = {4, 16, 37, 58, 89, 145, 42, 20}def get_next(number):total_sum = 0while number > 0:number, digit = divmod(number, 10)total_sum += digit ** 2return total_sumwhile n != 1 and n not in cycle_members:n = get_next(n)return n == 1