Leetcode : Happy Number

Write an algorithm to determine if a number n is happy.