Skip to content

Commit 5cb27b3

Browse files
committed
Fixed sonar
1 parent 0fcbaca commit 5cb27b3

File tree

2 files changed

+9
-1
lines changed
  • src/main/java/g3601_3700

2 files changed

+9
-1
lines changed

src/main/java/g3601_3700/s3678_smallest_absent_positive_greater_than_average/Solution.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,14 @@ public int smallestAbsent(int[] nums) {
1818
int n = nums.length;
1919
Arrays.sort(nums);
2020
avg = sum / n;
21-
double j = avg < 0 ? 1 : Math.ceil(avg) == avg ? avg + 1 : Math.ceil(avg);
21+
double j;
22+
if (avg < 0) {
23+
j = 1;
24+
} else if (Math.ceil(avg) == avg) {
25+
j = avg + 1;
26+
} else {
27+
j = Math.ceil(avg);
28+
}
2229
for (int i = (int) j; i <= 100; i++) {
2330
if (!set.contains(i)) {
2431
return i;

src/main/java/g3601_3700/s3685_subsequence_sum_after_capping_elements/Solution.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import java.util.Arrays;
66

7+
@SuppressWarnings("java:S135")
78
public class Solution {
89
private static final int MAX_K = 4001;
910
private final boolean[] dp = new boolean[MAX_K];

0 commit comments

Comments
 (0)