Skip to content

Commit b679b55

Browse files
committedMar 22, 2023
Time: 60 ms (59.03%), Space: 41.3 MB (97.74%) - LeetHub
1 parent 8de4754 commit b679b55

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* @param {number} num
3+
* @return {number}
4+
*/
5+
var countDigits = function countDigit(num) {
6+
const numArray = num.toString().split("");
7+
let count = 0;
8+
for (let i = 0; i < numArray.length; i++) {
9+
if (num % parseInt(numArray[i]) === 0) {
10+
count++;
11+
}
12+
}
13+
return count;
14+
}

0 commit comments

Comments
 (0)