Given an integer n, determine whether it is a happy number. Repeatedly replace the number with the sum of the squares of its digits; if the process ends at 1, the number is happy.
n = positive integer
true if n is happy, otherwise false
Example 1:
Input:
n = 19
Output:
true
Explanation:
19 eventually reaches 1.
Example 2:
Input:
n = 2
Output:
false
Explanation:
2 falls into a cycle and never reaches 1.