mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-04 23:11:41 +08:00
存量题库数据更新
This commit is contained in:
@@ -1,28 +1,28 @@
|
||||
<p>Given an integer array <code>nums</code>, find the contiguous subarray (containing at least one number) which has the largest sum and return <em>its sum</em>.</p>
|
||||
|
||||
<p>A <strong>subarray</strong> is a <strong>contiguous</strong> part of an array.</p>
|
||||
<p>Given an integer array <code>nums</code>, find the <span data-keyword="subarray-nonempty">subarray</span> with the largest sum, and return <em>its sum</em>.</p>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Example 1:</strong></p>
|
||||
<p><strong class="example">Example 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> nums = [-2,1,-3,4,-1,2,1,-5,4]
|
||||
<strong>Output:</strong> 6
|
||||
<strong>Explanation:</strong> [4,-1,2,1] has the largest sum = 6.
|
||||
<strong>Explanation:</strong> The subarray [4,-1,2,1] has the largest sum 6.
|
||||
</pre>
|
||||
|
||||
<p><strong>Example 2:</strong></p>
|
||||
<p><strong class="example">Example 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> nums = [1]
|
||||
<strong>Output:</strong> 1
|
||||
<strong>Explanation:</strong> The subarray [1] has the largest sum 1.
|
||||
</pre>
|
||||
|
||||
<p><strong>Example 3:</strong></p>
|
||||
<p><strong class="example">Example 3:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> nums = [5,4,-1,7,8]
|
||||
<strong>Output:</strong> 23
|
||||
<strong>Explanation:</strong> The subarray [5,4,-1,7,8] has the largest sum 23.
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
|
Reference in New Issue
Block a user