Skip to content

Commit ae69158

Browse files
add 1800
1 parent bacd984 commit ae69158

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ _If you like this project, please leave me a star._ ★
88

99
| # | Title | Solutions | Video | Difficulty | Tag
1010
|-----|----------------|---------------|--------|-------------|-------------
11+
|1800|[Maximum Ascending Subarray Sum](https://leetcode.com/problems/maximum-ascending-subarray-sum/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1800.java) ||Easy|Two Pointers|
1112
|1797|[Design Authentication Manager](https://leetcode.com/problems/design-authentication-manager/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1797.java) ||Medium|HashTable, Design|
1213
|1796|[Second Largest Digit in a String](https://leetcode.com/problems/second-largest-digit-in-a-string/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1796.java) ||Easy|String|
1314
|1792|[Maximum Average Pass Ratio](https://leetcode.com/problems/maximum-average-pass-ratio/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1792.java) ||Medium|Heap|
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.fishercoder.solutions;
2+
3+
public class _1800 {
4+
public static class Solution1 {
5+
public int maxAscendingSum(int[] nums) {
6+
int maxSum = nums[0];
7+
for (int i = 0, j = i + 1; i < nums.length - 1 && j < nums.length; j++) {
8+
int sum = nums[j - 1];
9+
while (j < nums.length && nums[j] - nums[j - 1] > 0) {
10+
sum += nums[j];
11+
j++;
12+
}
13+
i = j;
14+
maxSum = Math.max(maxSum, sum);
15+
}
16+
return maxSum;
17+
}
18+
}
19+
}

0 commit comments

Comments
 (0)