https://leetcode.com/problems/maximum-ascending-subarray-sum/



Runtime: 78 ms, faster than 81.25% of TypeScript online submissions for Maximum Ascending Subarray Sum.

Memory Usage: 49.4 MB, less than 6.25% of TypeScript online submissions for Maximum Ascending Subarray Sum.



```typescript
function checkIfAscending(nums: number[]): boolean {
    let last = null
    for (const num of nums) {
        if (last != null) {
            if ((num-last)<=0) {
                return false
            }
        }
        last = num
    }
    return true
}

function maxAscendingSum(nums: number[]): number {
    //8:09
    let max_value = Math.max(...nums);
    for (let a=0; a < nums.length; ++a) {
        for (let b=0; b < nums.length; ++b) {
            const subArray = nums.slice(a, b+1)
            if (subArray.length > 0) {
                if (checkIfAscending(subArray)) {
                    const tempValue = subArray.reduce((partialSum, a) => partialSum + a, 0)
                    if (tempValue > max_value) {
                        max_value = tempValue
                    }
                }
            }
        }
    }
    return max_value
    //8:17
};
```
