Description
Submission
class Solution { public: int maxAbsoluteSum(vector<int>& nums) { nums.insert(nums.begin(), 0); int n = nums.size(); vector<int> presum(n); presum[0] = 0; for(int i = 1; i < n; ++i) { presum[i] = presum[i-1] + nums[i]; } int minimum = *min_element(presum.begin(), presum.end()); int maximum = *max_element(presum.begin(), presum.end()); return maximum - minimum; } };