Skip to content

Commit 1b5588b

Browse files
committed
Time: 1 ms (95.08%), Space: 40.7 MB (78.79%) - LeetHub
1 parent 2c0ecb8 commit 1b5588b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
class Solution {
2+
public int divisorSubstrings(int num, int k) {
3+
int windowStart = 0;
4+
int windowNum = Integer.MAX_VALUE;
5+
String numb = String.valueOf(num);
6+
int counter = 0;
7+
8+
for (int windowEnd = k - 1; windowEnd < numb.length(); windowEnd++) {
9+
String sub = numb.substring(windowStart++,windowEnd + 1);
10+
11+
int temp = Integer.parseInt(sub);
12+
if (temp == 0) continue;
13+
else if (num % temp == 0) {
14+
counter++;
15+
}
16+
17+
} return counter;
18+
}
19+
}

0 commit comments

Comments
 (0)