package leetcode;

/**
 * https://leetcode.com/problems/maximum-absolute-sum-of-any-subarray/
 */
public class Problem1749 {
    public int maxAbsoluteSum(int[] nums) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem1749 prob = new Problem1749();
        System.out.println(prob.maxAbsoluteSum(new int[]{1,-3,2,3,-4})); // 5
        System.out.println(prob.maxAbsoluteSum(new int[]{2,-5,1,-4,3,-2})); // 8
    }
}

@@ -174,290 +174,498 @@
     
-// TODO%0A        return 0
+int max = nums%5B0%5D;%0A        int maxSoFar = nums%5B0%5D
 ;%0A    
+ 
-%7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        Problem1749 prob = new Problem1749();%0A        System.out.println(prob.maxAbsoluteSum(new int%5B%5D%7B1,-3,2,3,-4%7D)); // 5%0A        System.out.println(prob.maxAbsoluteSum(new int%5B%5D%7B2,-5,1,-4,3,-2%7D)); // 8
+   for (int i = 1; i %3C nums.length; i++) %7B%0A            maxSoFar = Math.max(maxSoFar + nums%5Bi%5D, nums%5Bi%5D);%0A            max = Math.max(max, maxSoFar);%0A        %7D%0A        int min = nums%5B0%5D;%0A        int minSoFar = nums%5B0%5D;%0A        for (int i = 1; i %3C nums.length; i++) %7B%0A            minSoFar = Math.min(minSoFar + nums%5Bi%5D, nums%5Bi%5D);%0A            min = Math.min(min, minSoFar);%0A        %7D%0A        return Math.max(Math.abs(max), Math.abs(min));
 %0A   

Solve problem 1749