package leetcode;

/**
 * https://leetcode.com/problems/maximum-ascending-subarray-sum/
 */
public class Problem1800 {
    public int maxAscendingSum(int[] nums) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem1800 prob = new Problem1800();
        System.out.println(prob.maxAscendingSum(new int[]{10,20,30,5,10,50})); // 65
        System.out.println(prob.maxAscendingSum(new int[]{10,20,30,40,50})); // 150
        System.out.println(prob.maxAscendingSum(new int[]{12,17,15,13,10,11,12})); // 33
        System.out.println(prob.maxAscendingSum(new int[]{100,10,1})); // 100
    }
}

@@ -169,467 +169,332 @@
     
-// TODO%0A        return 0
+int answer = nums%5B0%5D;%0A        int sum = nums%5B0%5D
 ;%0A    
-%7D%0A%0A
     
-public static void main(String%5B%5D args) %7B%0A        Problem1800 prob = new Problem1800();%0A        System.out.println(prob.maxAscendingSum(new int%5B%5D%7B10,20,30,5,10,50%7D)); // 65%0A        System.out.println(prob.maxAscendingSum(new int%5B%5D%7B10,20,30,40,50%7D)); // 150%0A        System.out.println(prob.maxAscendingSum(new int%5B%5D%7B12,17,15,13,10,11,12%7D)); // 33%0A        System.out.println(prob.maxAscendingSum(new int%5B%5D%7B100,10,1%7D)); // 100
+for (int i = 0; i %3C nums.length - 1; i++) %7B%0A            if (nums%5Bi%5D %3C nums%5Bi + 1%5D) %7B%0A                sum += nums%5Bi + 1%5D;%0A            %7D else %7B%0A                sum = nums%5Bi + 1%5D;%0A            %7D%0A            answer = Math.max(answer, sum);%0A        %7D%0A        return answer;
 %0A   

Solve problem 1800