← Back to all problems
Easy

Happy Number

Updated Feb 24, 2026

Problem

Determine if n is a happy number.

Constraints

1 <= n <= 2^31 - 1

Examples

Example 1

Input: {"n": 19}
Output: true

Function Signature

def isHappy(self, n: int) -> bool

How to Submit

Implement a Solution class with a isHappy method.

Your method will be called with the input parameters and should return the answer.