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

Appearance settings

Commit 07480d6

Browse filesBrowse files
[LEET-3345] add 3345
1 parent 7ae0dca commit 07480d6
Copy full SHA for 07480d6

File tree

3 files changed

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

3 files changed

+46
-0
lines changed

‎paginated_contents/algorithms/4th_thousand/README.md

Copy file name to clipboardExpand all lines: paginated_contents/algorithms/4th_thousand/README.md
+1Lines 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 |
+24Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.fishercoder.solutions.fourththousand;
2+
3+
public class _3345 {
4+
public static class Solution1 {
5+
public int smallestNumber(int n, int t) {
6+
for (int num = n; ; num++) {
7+
int digitSum = getDigitsProduct(num);
8+
if (digitSum % t == 0) {
9+
return num;
10+
}
11+
}
12+
}
13+
14+
private int getDigitsProduct(int num) {
15+
int copy = num;
16+
int product = 1;
17+
while (copy != 0) {
18+
product *= copy % 10;
19+
copy /= 10;
20+
}
21+
return product;
22+
}
23+
}
24+
}
+21Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.fishercoder.fourththousand;
2+
3+
import static org.junit.jupiter.api.Assertions.assertEquals;
4+
5+
import com.fishercoder.solutions.fourththousand._3345;
6+
import org.junit.jupiter.api.BeforeEach;
7+
import org.junit.jupiter.api.Test;
8+
9+
public class _3345Test {
10+
private _3345.Solution1 solution1;
11+
12+
@BeforeEach
13+
public void setup() {
14+
solution1 = new _3345.Solution1();
15+
}
16+
17+
@Test
18+
public void test1() {
19+
assertEquals(10, solution1.smallestNumber(10, 2));
20+
}
21+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.