1800. Maximum Ascending Subarray Sum
On This Page
class Solution:
def maxAscendingSum(self, nums: List[int]) -> int:
res = t = 0
for i, v in enumerate(nums):
if i == 0 or v > nums[i - 1]:
t += v
res = max(res, t)
else:
t = v
return res