Google interview question

Write an algorithm to find if a number is happy