1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-13 19:31:42 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

add leetcode problem-cn part3

This commit is contained in:
2022-03-27 20:46:41 +08:00
parent 6dafca13c5
commit dfacb20d31
1385 changed files with 115239 additions and 3 deletions

View File

@@ -0,0 +1,46 @@
<p>给出非负整数数组 <code>A</code> ,返回两个非重叠(连续)子数组中元素的最大和,子数组的长度分别为 <code>L</code><code>M</code>。(这里需要澄清的是,长为 L 的子数组可以出现在长为 M 的子数组之前或之后。)</p>
<p>从形式上看,返回最大的 <code>V</code>,而 <code>V = (A[i] + A[i+1] + ... + A[i+L-1]) + (A[j] + A[j+1] + ... + A[j+M-1])</code> 并满足下列条件之一:</p>
<p>&nbsp;</p>
<ul>
<li><code>0 &lt;= i &lt; i + L - 1 &lt; j &lt; j + M - 1 &lt; A.length</code>, <strong></strong></li>
<li><code>0 &lt;= j &lt; j + M - 1 &lt; i &lt; i + L - 1 &lt; A.length</code>.</li>
</ul>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>A = [0,6,5,2,2,5,1,9,4], L = 1, M = 2
<strong>输出:</strong>20
<strong>解释:</strong>子数组的一种选择中,[9] 长度为 1[6,5] 长度为 2。
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>A = [3,8,1,3,2,1,8,9,0], L = 3, M = 2
<strong>输出:</strong>29
<strong>解释:</strong>子数组的一种选择中,[3,8,1] 长度为 3[8,9] 长度为 2。
</pre>
<p><strong>示例 3</strong></p>
<pre>
<strong>输入:</strong>A = [2,1,5,6,0,9,5,0,3,8], L = 4, M = 3
<strong>输出:</strong>31
<strong>解释:</strong>子数组的一种选择中,[5,6,0,9] 长度为 4[0,3,8] 长度为 3。</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>L &gt;= 1</code></li>
<li><code>M &gt;= 1</code></li>
<li><code>L + M &lt;= A.length &lt;= 1000</code></li>
<li><code>0 &lt;= A[i] &lt;= 1000</code></li>
</ul>