Anonymous interview question

Happy Number from leetcode was asked