File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
src/main/java/g3101_3200/s3180_maximum_total_reward_using_operations_i Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change 2
2
3
3
// #Medium #Array #Dynamic_Programming #2024_06_14_Time_1_ms_(100.00%)_Space_43.3_MB_(97.85%)
4
4
5
+ @ SuppressWarnings ("java:S135" )
5
6
public class Solution {
6
7
private int [] sortedSet (int [] values ) {
7
8
int max = 0 ;
@@ -34,7 +35,8 @@ public int maxTotalReward(int[] rewardValues) {
34
35
boolean [] isSumPossible = new boolean [max ];
35
36
isSumPossible [0 ] = true ;
36
37
int maxSum = 0 ;
37
- for (int sum = rewardValues [0 ], last = 1 ; sum < max ; sum ++) {
38
+ int last = 1 ;
39
+ for (int sum = rewardValues [0 ]; sum < max ; sum ++) {
38
40
while (last < n && rewardValues [last ] <= sum ) {
39
41
last ++;
40
42
}
@@ -50,6 +52,7 @@ public int maxTotalReward(int[] rewardValues) {
50
52
break ;
51
53
}
52
54
}
55
+ last ++;
53
56
}
54
57
return maxSum + max ;
55
58
}
You can’t perform that action at this time.
0 commit comments