Practice Maximum Absolute Sum of Any Subarray
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
You are given an integer array nums. The absolute sum of a subarray [numsl, numsl+1, ..., numsr-1, numsr] is abs(numsl + numsl+1 + ... + numsr-1 + numsr). Return the maximum absolute sum of any (possibly empty) subarray of nums. Note that abs(x) is defined as follows:
Source: Maximum Absolute Sum of Any Subarray on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
nums = [1,-3,2,3,-4]
Output
5
# Example 2
Input
nums = [2,-5,1,-4,3,-2]
Output
8
Constraints
1 <= nums.length <= 10^5
-10^4 <= nums[i] <= 10^4
Related LeetCode Problems
Practice more problems similar to Maximum Absolute Sum of Any Subarray.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.