1749. Maximum Absolute Sum of Any Subarray
https://leetcode.com/problems/maximum-absolute-sum-of-any-subarray
Description
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:
If
x
is a negative integer, thenabs(x) = -x
.If
x
is a non-negative integer, thenabs(x) = x
.
Example 1:
Example 2:
Constraints:
1 <= nums.length <= 105
-104 <= nums[i] <= 104
ac
Last updated