Free written solutionMaximum Absolute Sum of Any Subarray (LeetCode 1749): Solution and Explanation
Find the subarray whose sum is furthest from zero, in either direction, and return that distance. The empty subarray counts and has sum 0. For [1,-3,2,3,-4] the answer is 5, from the subarray [2,3].
Read the intuition, approach, code and complexity →