Given an array of positive integers nums, return the maximum possible sum of an ascending subarray in nums.

A subarray is defined as a contiguous sequence of numbers in an array.

A subarray [numsl, numsl+1, ..., numsr-1, numsr] is ascending if for all i where l &lt;= i &lt; r, numsi  &lt; numsi+1. Note that a subarray of size 1 is ascending.

&nbsp;
Example 1:

Input: nums = [10,20,30,5,10,50]
Output: 65
Explanation: [5,10,50] is the ascending subarray with the maximum sum of 65.


Example 2:

Input: nums = [10,20,30,40,50]
Output: 150
Explanation: [10,20,30,40,50] is the ascending subarray with the maximum sum of 150.


Example 3:

Input: nums = [12,17,15,13,10,11,12]
Output: 33
Explanation: [10,11,12] is the ascending subarray with the maximum sum of 33.


&nbsp;
Constraints:


	1 &lt;= nums.length &lt;= 100
	1 &lt;= nums[i] &lt;= 100


class Solution:
    def maxAscendingSum(self, nums: List[int]) -> int:
        count=nums[0]
        final=nums[0]
        for i in range(1,len(nums)):
            if nums[i]>nums[i-1]:
                count+=nums[i]
            else:
                count=nums[i]
            final=max(final,count)
        return final
class Solution {
    public int maxAscendingSum(int[] nums) {
        int res = nums[0],temp = nums[0];
        for(int i = 1;i<nums.length;i++){
            if(nums[i] > nums[i-1])
                temp+=nums[i];
            else
                temp = nums[i];
            res = Math.max(res,temp);
        }
        return res;
    }
}
class Solution {
public:
    int maxAscendingSum(vector<int>& nums) {
        int max_sum = nums[0], curr = nums[0];
        for (int i = 1; i < nums.size(); i++) {
            if (nums[i-1] < nums[i]) {
                curr += nums[i];
            }
            else {
                max_sum = max(max_sum, curr);
                curr = nums[i];
            }
        }
        return max(max_sum, curr);
    }
};
var maxAscendingSum = function(nums) {
    const subarray = nums.reduce((acc, curr, index) => {
        curr > nums[index - 1] ? acc[acc.length - 1] += curr : acc.push(curr);
        return acc;
    }, []);

    return Math.max(...subarray);
};
Maximum Ascending Subarray Sum