Open GH1995 opened 5 years ago
Difficulty: Hard
Given an array nums, we call (i, j) an important reverse pair if i < j and nums[i] > 2*nums[j].
nums
(i, j)
i < j
nums[i] > 2*nums[j]
You need to return the number of important reverse pairs in the given array.
Example1:
Input: [1,3,2,3,1] Output: 2
Example2:
Input: [2,4,3,5,1] Output: 3
Note:
50,000
493. Reverse Pairs
Difficulty: Hard
Given an array
nums
, we call(i, j)
an important reverse pair ifi < j
andnums[i] > 2*nums[j]
.You need to return the number of important reverse pairs in the given array.
Example1:
Example2:
Note:
50,000
.