mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-04 15:01:40 +08:00
国外版
This commit is contained in:
19
算法题(国外版)/reverse-pairs.html
Normal file
19
算法题(国外版)/reverse-pairs.html
Normal file
@@ -0,0 +1,19 @@
|
||||
<p>Given an integer array <code>nums</code>, return <em>the number of <strong>reverse pairs</strong> in the array</em>.</p>
|
||||
|
||||
<p>A reverse pair is a pair <code>(i, j)</code> where <code>0 <= i < j < nums.length</code> and <code>nums[i] > 2 * nums[j]</code>.</p>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Example 1:</strong></p>
|
||||
<pre><strong>Input:</strong> nums = [1,3,2,3,1]
|
||||
<strong>Output:</strong> 2
|
||||
</pre><p><strong>Example 2:</strong></p>
|
||||
<pre><strong>Input:</strong> nums = [2,4,3,5,1]
|
||||
<strong>Output:</strong> 3
|
||||
</pre>
|
||||
<p> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= nums.length <= 5 * 10<sup>4</sup></code></li>
|
||||
<li><code>-2<sup>31</sup> <= nums[i] <= 2<sup>31</sup> - 1</code></li>
|
||||
</ul>
|
Reference in New Issue
Block a user