> For the complete documentation index, see [llms.txt](https://emmaguo100.gitbook.io/leetcode/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://emmaguo100.gitbook.io/leetcode/04-19-2022-202.-happy-number.md).

# 04/19/2022 202. Happy Number

Method: this problem can be divided into 2 situations. First, After the operation required by the question, the number would become 1. Another case is the numbers would stuck in circle/loop. So we first write a getNumber method to get the sum of the square of each digit. Then we use HashSet to decide if the number next to add is in the set.

Time O(logn)

Space O(N)
