You are given a positive integer n. Repeatedly replace the number with the sum of the squares of its digits. Your task is to determine whether this process eventually reaches 1.
If the process reaches 1, the number is called a happy number, and you should return Yes. If the process enters a cycle that never reaches 1, return No.
Input: n = 19
Output: Yes
Explanation: The process follows 19 → 82 → 68 → 100 → 1, so the number is happy.
Input: n = 4
Output: No
Explanation: The process enters a repeating cycle that never reaches 1, so 4 is not a happy number.
Input: n = 1
Output: Yes
Explanation: The number is already 1, so it is a happy number.
Sign in to write, run, and submit your solution against the full test suite.