Question

Write a function to check whether the given number is a happy number?

Login to Submit

Examples

A number is a happy number if you keep on squaring the digits and add it eventually it will reach 1.

Input: 7
Output: true

7^2 = 49 
4^2 + 9^2 = 97
9^2 + 7^2 = 130
1^2 + 3^2 + 0^2 = 10
1^2 + 0^2 = 1