Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 1779d58

Browse files
committedOct 25, 2024·
[LEET-3300] add 3300
1 parent 32391a3 commit 1779d58

File tree

2 files changed

+113
-90
lines changed
  • paginated_contents/algorithms/4th_thousand
  • src/main/java/com/fishercoder/solutions/fourththousand

2 files changed

+113
-90
lines changed
 

‎paginated_contents/algorithms/4th_thousand/README.md

Lines changed: 91 additions & 90 deletions
Large diffs are not rendered by default.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.fishercoder.solutions.fourththousand;
2+
3+
public class _3300 {
4+
public static class Solution1 {
5+
public int minElement(int[] nums) {
6+
int min = Integer.MAX_VALUE;
7+
for (int num : nums) {
8+
min = Math.min(min, findSum(num));
9+
}
10+
return min;
11+
}
12+
13+
private int findSum(int num) {
14+
int sum = 0;
15+
while (num != 0) {
16+
sum += num % 10;
17+
num /= 10;
18+
}
19+
return sum;
20+
}
21+
}
22+
}

0 commit comments

Comments
 (0)
Please sign in to comment.