2520. Count the Digits That Divide a Number
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| class Solution { public int countDigits(int num) { int count = 0;
int tmp = num; do { if (num % (tmp % 10) == 0) { count++; } tmp /= 10; } while (tmp != 0);
return count; } }
|
References
2520. Count the Digits That Divide a Number