#202

Happy Number

easy· Math & Geometryruns: 0

Write an algorithm to determine if a number n is happy. A happy number is defined as follows: starting with any positive integer, replace the number by the sum of the squares of its digits and repeat. The number is happy if it eventually reaches 1; otherwise it loops endlessly in a cycle that does not include 1. Return true if n is happy, otherwise false.

sign in to paste and practice your own solution
desktop only

codedrill is a typing game and needs a real keyboard. open this on a laptop or desktop to practice.

you can still browse problems and sections from your phone.