Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit07480d6

Browse files
[LEET-3345] add 3345
1 parent7ae0dca commit07480d6

File tree

3 files changed

+46
-0
lines changed
  • paginated_contents/algorithms/4th_thousand
  • src

3 files changed

+46
-0
lines changed

‎paginated_contents/algorithms/4th_thousand/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
| 3360|[Stone Removal Game](https://leetcode.com/problems/stone-removal-game/)|[Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3360.java)|| Easy|
55
| 3354|[Make Array Elements Equal to Zero](https://leetcode.com/problems/make-array-elements-equal-to-zero/)|[Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3354.java)|| Easy|
66
| 3349|[Adjacent Increasing Subarrays Detection I](https://leetcode.com/problems/adjacent-increasing-subarrays-detection-i/)|[Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3349.java)|| Easy|
7+
| 3345|[Smallest Divisible Digit Product I](https://leetcode.com/problems/smallest-divisible-digit-product-i/)|[Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3345.java)|| Easy|
78
| 3340|[Check Balanced String](https://leetcode.com/problems/check-balanced-string/)|[Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3340.java)|| Easy|
89
| 3330|[Find the Original Typed String I](https://leetcode.com/problems/find-the-original-typed-string-i/)|[Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3330.java)|| Easy|
910
| 3324|[Find the Sequence of Strings Appeared on the Screen](https://leetcode.com/problems/find-the-sequence-of-strings-appeared-on-the-screen/)|[Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3324.java)|| Easy|
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
packagecom.fishercoder.solutions.fourththousand;
2+
3+
publicclass_3345 {
4+
publicstaticclassSolution1 {
5+
publicintsmallestNumber(intn,intt) {
6+
for (intnum =n; ;num++) {
7+
intdigitSum =getDigitsProduct(num);
8+
if (digitSum %t ==0) {
9+
returnnum;
10+
}
11+
}
12+
}
13+
14+
privateintgetDigitsProduct(intnum) {
15+
intcopy =num;
16+
intproduct =1;
17+
while (copy !=0) {
18+
product *=copy %10;
19+
copy /=10;
20+
}
21+
returnproduct;
22+
}
23+
}
24+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
packagecom.fishercoder.fourththousand;
2+
3+
importstaticorg.junit.jupiter.api.Assertions.assertEquals;
4+
5+
importcom.fishercoder.solutions.fourththousand._3345;
6+
importorg.junit.jupiter.api.BeforeEach;
7+
importorg.junit.jupiter.api.Test;
8+
9+
publicclass_3345Test {
10+
private_3345.Solution1solution1;
11+
12+
@BeforeEach
13+
publicvoidsetup() {
14+
solution1 =new_3345.Solution1();
15+
}
16+
17+
@Test
18+
publicvoidtest1() {
19+
assertEquals(10,solution1.smallestNumber(10,2));
20+
}
21+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp