Description
Given a non-negative integer n, return the sum of the squares of its decimal digits. For example, the digit-square-sum of 19 is 1² + 9² = 82.
Examples
Input:
n = 19Output:
82Explanation:
Digits are 1 and 9. 1² + 9² = 1 + 81 = 82.
Input:
n = 7Output:
49Explanation:
Single digit 7; 7² = 49.
Input:
n = 100Output:
1Explanation:
Digits are 1, 0, 0. 1² + 0² + 0² = 1.
Input:
n = 0Output:
0Explanation:
Single digit 0; result = 0.
Constraints
- •
0 ≤ n ≤ 2³¹ - 1