Happy number

0
Remix

Replace a number with the sum of the squares of its digits and repeat. Return whether it reaches 1 or loops forever. Detect the loop with a set of seen values or with fast and slow pointers.

AppleTechnical phone screenLast asked Oct 2025
No answer yet. Write the first one; the best answer gets endorsed.