Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 2057e6f

Browse files
add 2269
1 parent cda1ae3 commit 2057e6f

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ _If you like this project, please leave me a star._ ★
88

99
| # | Title | Solutions | Video | Difficulty | Tag
1010
|------|----------------|------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------|-------------|-------------
11+
| 2269 |[Find the K-Beauty of a Number](https://leetcode.com/problems/find-the-k-beauty-of-a-number/)| [Java](../master/src/main/java/com/fishercoder/solutions/_2269.java) || Easy ||
1112
| 2264 |[Largest 3-Same-Digit Number in String](https://leetcode.com/problems/largest-3-same-digit-number-in-string/)| [Java](../master/src/main/java/com/fishercoder/solutions/_2264.java) || Easy ||
1213
| 2260 |[Minimum Consecutive Cards to Pick Up](https://leetcode.com/problems/minimum-consecutive-cards-to-pick-up/)| [Java](../master/src/main/java/com/fishercoder/solutions/_2260.java) || Medium ||
1314
| 2259 |[Remove Digit From Number to Maximize Result](https://leetcode.com/problems/remove-digit-from-number-to-maximize-result/)| [Java](../master/src/main/java/com/fishercoder/solutions/_2259.java) || Easy ||
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.fishercoder.solutions;
2+
3+
public class _2269 {
4+
public static class Solution1 {
5+
public int divisorSubstrings(int num, int k) {
6+
String numStr = new StringBuilder().append(num).toString();
7+
int ans = 0;
8+
for (int i = 0; i + k <= numStr.length(); i++) {
9+
String candidate = numStr.substring(i, i + k);
10+
int integer = Integer.parseInt(candidate);
11+
if (integer == 0) {
12+
continue;
13+
}
14+
if (num % integer == 0) {
15+
ans++;
16+
}
17+
}
18+
return ans;
19+
}
20+
}
21+
}

0 commit comments

Comments
 (0)