Skip to content

Commit f19f210

Browse files
committed
Create README - LeetHub
1 parent e33ff00 commit f19f210

File tree

1 file changed

+35
-0
lines changed
  • 1749-maximum-absolute-sum-of-any-subarray

1 file changed

+35
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<h2><a href="https://leetcode.com/problems/maximum-absolute-sum-of-any-subarray/">1749. Maximum Absolute Sum of Any Subarray</a></h2><h3>Medium</h3><hr><p>You are given an integer array <code>nums</code>. The <strong>absolute sum</strong> of a subarray <code>[nums<sub>l</sub>, nums<sub>l+1</sub>, ..., nums<sub>r-1</sub>, nums<sub>r</sub>]</code> is <code>abs(nums<sub>l</sub> + nums<sub>l+1</sub> + ... + nums<sub>r-1</sub> + nums<sub>r</sub>)</code>.</p>
2+
3+
<p>Return <em>the <strong>maximum</strong> absolute sum of any <strong>(possibly empty)</strong> subarray of </em><code>nums</code>.</p>
4+
5+
<p>Note that <code>abs(x)</code> is defined as follows:</p>
6+
7+
<ul>
8+
<li>If <code>x</code> is a negative integer, then <code>abs(x) = -x</code>.</li>
9+
<li>If <code>x</code> is a non-negative integer, then <code>abs(x) = x</code>.</li>
10+
</ul>
11+
12+
<p>&nbsp;</p>
13+
<p><strong class="example">Example 1:</strong></p>
14+
15+
<pre>
16+
<strong>Input:</strong> nums = [1,-3,2,3,-4]
17+
<strong>Output:</strong> 5
18+
<strong>Explanation:</strong> The subarray [2,3] has absolute sum = abs(2+3) = abs(5) = 5.
19+
</pre>
20+
21+
<p><strong class="example">Example 2:</strong></p>
22+
23+
<pre>
24+
<strong>Input:</strong> nums = [2,-5,1,-4,3,-2]
25+
<strong>Output:</strong> 8
26+
<strong>Explanation:</strong> The subarray [-5,1,-4] has absolute sum = abs(-5+1-4) = abs(-8) = 8.
27+
</pre>
28+
29+
<p>&nbsp;</p>
30+
<p><strong>Constraints:</strong></p>
31+
32+
<ul>
33+
<li><code>1 &lt;= nums.length &lt;= 10<sup>5</sup></code></li>
34+
<li><code>-10<sup>4</sup> &lt;= nums[i] &lt;= 10<sup>4</sup></code></li>
35+
</ul>

0 commit comments

Comments
 (0)