Happy Number: the skills you need first
Updated
LeetCode · easy · hash sets. The sum-of-squares walk is a chain. A seen-set catches the cycle.
Skills this problem builds on
Stuck on Happy Number? It is usually one of these. Get each one solid and the solution stops being a trick.
- Mark visited with a set
- Detect a repeat visit
check which ones you have 10 minutes, free, no account.