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

存量题库数据更新

This commit is contained in:
2023-12-09 18:42:21 +08:00
parent a788808cd7
commit c198538f10
10843 changed files with 288489 additions and 248355 deletions

View File

@@ -1,20 +1,15 @@
<p>出非负整数数组 <code>A</code> ,返回两个非重叠(连续)子数组中元素的最大和,子数组的长度分别为 <code>L</code><code>M</code>(这里需要澄清的是,长为 L 的子数组可以出现在长为 M 的子数组之前或之后。)</p>
<p>你一个整数数组 <code>nums</code> 和两个整数 <code>firstLen</code><code>secondLen</code>,请你找出并返回两个非重叠<strong> 子数组 </strong>中元素的最大和<em></em>长度分别为 <code>firstLen</code><code>secondLen</code> </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>长度为 <code>firstLen</code> 的子数组可以出现在长为 <code>secondLen</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>子数组是数组的一个 <strong>连续</strong> 部分。</p>
<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>nums = [0,6,5,2,2,5,1,9,4], firstLen = 1, secondLen = 2
<strong>输出:</strong>20
<strong>解释:</strong>子数组的一种选择中,[9] 长度为 1[6,5] 长度为 2。
</pre>
@@ -22,7 +17,7 @@
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>A = [3,8,1,3,2,1,8,9,0], L = 3, M = 2
<strong>输入:</strong>nums = [3,8,1,3,2,1,8,9,0], firstLen = 3, secondLen = 2
<strong>输出:</strong>29
<strong>解释:</strong>子数组的一种选择中,[3,8,1] 长度为 3[8,9] 长度为 2。
</pre>
@@ -30,17 +25,18 @@
<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>nums = [2,1,5,6,0,9,5,0,3,8], firstLen = 4, secondLen = 3
<strong>输出:</strong>31
<strong>解释:</strong>子数组的一种选择中,[5,6,0,9] 长度为 4[0,3,8] 长度为 3。</pre>
<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>
<li><code>1 &lt;= firstLen, secondLen &lt;= 1000</code></li>
<li><code>2 &lt;= firstLen + secondLen &lt;= 1000</code></li>
<li><code>firstLen + secondLen &lt;= nums.length &lt;= 1000</code></li>
<li><code>0 &lt;= nums[i] &lt;= 1000</code></li>
</ul>