You are given a positive integer n.
Let digitSum be the sum of the digits of n, and let squareSum be the sum of the squares of the digits of n.
An integer is called good if squareSum - digitSum >= 50.
Return true if n is good. Otherwise, return false.
Example 1:
Input: n = 1000
Output: false
Explanation:
digitSum is 1 + 0 + 0 + 0 = 1.squareSum is 12 + 02 + 02 + 02 = 1.squareSum - digitSum is 1 - 1 = 0. As 0 is not greater than or equal to 50, the output is false.Example 2:
Input: n = 19
Output: true
Explanation:
digitSum is 1 + 9 = 10.squareSum is 12 + 92 = 1 + 81 = 82.squareSum - digitSum is 82 - 10 = 72. As 72 is greater than or equal to 50, the output is true.Constraints:
1 <= n <= 109Loading editor...
1000