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

批量更新数据

This commit is contained in:
2025-01-09 20:29:41 +08:00
parent 04ecea043d
commit 48cdd06c2b
5053 changed files with 156164 additions and 135322 deletions

View File

@@ -11,24 +11,24 @@
<pre>
<strong>输入:</strong>prices = [7,1,5,3,6,4]
<strong>输出:</strong>7
<strong>解释:</strong>在第 2 天(股票价格 = 1的时候买入在第 3 天(股票价格 = 5的时候卖出, 这笔交易所能获得利润 = 5 - 1 = 4
&nbsp; 随后,在第 4 天(股票价格 = 3的时候买入在第 5 天(股票价格 = 6的时候卖出, 这笔交易所能获得利润 = 6 - 3 = 3
总利润为 4 + 3 = 7 。</pre>
<strong>解释:</strong>在第 2 天(股票价格 = 1的时候买入在第 3 天(股票价格 = 5的时候卖出, 这笔交易所能获得利润 = 5 - 1 = 4。
随后,在第 4 天(股票价格 = 3的时候买入在第 5 天(股票价格 = 6的时候卖出, 这笔交易所能获得利润 = 6 - 3 = 3。
最大总利润为 4 + 3 = 7 。</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>prices = [1,2,3,4,5]
<strong>输出:</strong>4
<strong>解释:</strong>在第 1 天(股票价格 = 1的时候买入在第 5 天 (股票价格 = 5的时候卖出, 这笔交易所能获得利润 = 5 - 1 = 4
&nbsp; 总利润为 4 。</pre>
<strong>解释:</strong>在第 1 天(股票价格 = 1的时候买入在第 5 天 (股票价格 = 5的时候卖出, 这笔交易所能获得利润 = 5 - 1 = 4。
最大总利润为 4 。</pre>
<p><strong>示例&nbsp;3</strong></p>
<pre>
<strong>输入:</strong>prices = [7,6,4,3,1]
<strong>输出:</strong>0
<strong>解释:</strong>在这种情况下, 交易无法获得正利润,所以不参与交易可以获得最大利润,最大利润为 0 </pre>
<strong>解释:</strong>在这种情况下, 交易无法获得正利润,所以不参与交易可以获得最大利润,最大利润为 0。</pre>
<p>&nbsp;</p>