[LeetCode] Reverse Pairs 翻转对
Posted Grandyang
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[LeetCode] Reverse Pairs 翻转对相关的知识,希望对你有一定的参考价值。
Given an array nums
, we call (i, j)
an important reverse pair if i < j
and 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:
- The length of the given array will not exceed
50,000
. - All the numbers in the input array are in the range of 32-bit integer.
s
以上是关于[LeetCode] Reverse Pairs 翻转对的主要内容,如果未能解决你的问题,请参考以下文章