Given a positive integer ( n ), return its punishment number.
The punishment number of ( n ) is the sum of squares of all numbers ( i ) (where ( )) that satisfy:
Input:
n = 12
Output:
182
Explanation: Numbers satisfying the condition:
Total punishment number: ( 1 + 81 + 100 = 182 )
Input:
n = 25
Output:
182
Explanation: Numbers satisfying the condition:
Total punishment number: ( 1 + 81 + 100 = 182 )
https://leetcode.com/problems/find-the-punishment-number-of-an-integer/description/
Loading component...
Loading component...