Skip to content

Leetcode 202. Happy Number

We use a map the keep records of all the numbers during the process. If at any time the converted number equals to 1 we return true directly, otherwise if the number appeared earlier we return false instead. Solution