1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/最大升序子数组和 [maximum-ascending-subarray-sum].html
2022-03-29 12:43:11 +08:00

48 lines
1.6 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>给你一个正整数组成的数组 <code>nums</code> ,返回 <code>nums</code> 中一个 <strong>升序 </strong>子数组的最大可能元素和。</p>
<p>子数组是数组中的一个连续数字序列。</p>
<p>已知子数组 <code>[nums<sub>l</sub>, nums<sub>l+1</sub>, ..., nums<sub>r-1</sub>, nums<sub>r</sub>]</code> ,若对所有 <code>i</code><code>l <= i < r</code><code>nums<sub>i </sub> < nums<sub>i+1</sub></code> 都成立,则称这一子数组为 <strong>升序</strong> 子数组。注意,大小为 <code>1</code> 的子数组也视作 <strong>升序</strong> 子数组。</p>
<p> </p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>nums = [10,20,30,5,10,50]
<strong>输出:</strong>65
<strong>解释:</strong>[5,10,50] 是元素和最大的升序子数组,最大元素和为 65 。
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>nums = [10,20,30,40,50]
<strong>输出:</strong>150
<strong>解释:</strong>[10,20,30,40,50] 是元素和最大的升序子数组,最大元素和为 150 。
</pre>
<p><strong>示例 3</strong></p>
<pre>
<strong>输入:</strong>nums = [12,17,15,13,10,11,12]
<strong>输出:</strong>33
<strong>解释:</strong>[10,11,12] 是元素和最大的升序子数组,最大元素和为 33 。
</pre>
<p><strong>示例 4</strong></p>
<pre>
<strong>输入:</strong>nums = [100,10,1]
<strong>输出:</strong>100
</pre>
<p> </p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 <= nums.length <= 100</code></li>
<li><code>1 <= nums[i] <= 100</code></li>
</ul>