Skip to content

Latest commit

 

History

History
18 lines (14 loc) · 404 Bytes

untitled-33.md

File metadata and controls

18 lines (14 loc) · 404 Bytes

1800. Maximum Ascending Subarray Sum

class Solution:
    def maxAscendingSum(self, nums: List[int]) -> int:
        ans = nums[0]
        res = nums[0]
        for i in range(1,len(nums)):
            if nums[i] > nums[i - 1]:
                ans += nums[i]
            else:
                ans = nums[i]
                
            res = max(ans,res)
            
        return res