Happy Number
Replace n by the sum of the squares of its digits, repeatedly. Return True if this process reaches 1, and False if it loops forever.
Examples
EXAMPLE WALKTHROUGHhappy
A guided view of the published example, not a trace of your code.
INPUT
[19]TASKhappy_number()
EXPECTED OUTPUT
trueStart with the input values shown in this example.
Example 1 of 3
Input: n = 19
Output: true
Explanation: happy
Input: n = 2
Output: false
Explanation: loops
Input: n = 1
Output: true
Explanation: already one
Hint 1
Detect the loop with a set of seen values, or with fast and slow pointers.