1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-13 11:21:42 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2023-12-09 18:53:53 +08:00
parent c9b1bf36a8
commit 9bc4722a45
349 changed files with 15897 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
<p>在股票交易中,如果前一天的股价高于后一天的股价,则可以认为存在一个「交易逆序对」。请设计一个程序,输入一段时间内的股票交易记录 <code>record</code>,返回其中存在的「交易逆序对」总数。</p>
<p>&nbsp;</p>
<p><strong>示例 1:</strong></p>
<pre>
<strong>输入:</strong>record = [9, 7, 5, 4, 6]
<strong>输出:</strong>8
<strong>解释:</strong>交易中的逆序对为 (9, 7), (9, 5), (9, 4), (9, 6), (7, 5), (7, 4), (7, 6), (5, 4)。
</pre>
<p>&nbsp;</p>
<p><strong>限制:</strong></p>
<p><code>0 &lt;= record.length &lt;= 50000</code></p>