Skip to content

Commit b816e1f

Browse files
committed
Time: 0 ms (100%), Space: 40.6 MB (79.98%) - LeetHub
1 parent dc09f97 commit b816e1f

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class Solution {
2+
public boolean checkDivisibility(int n) {
3+
int num = n;
4+
int sum = 0;
5+
int product = 1;
6+
7+
while (num > 0) {
8+
sum += num % 10;
9+
product *= num % 10;
10+
num /= 10;
11+
}
12+
13+
return n % (sum + product) == 0;
14+
}
15+
}

0 commit comments

Comments
 (0)