美文网首页
493. Reverse Pairs

493. Reverse Pairs

作者: matrxyz | 来源:发表于2018-01-15 13:40 被阅读0次

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

https://leetcode.com/problems/reverse-pairs/discuss/97280

Solution:

思路:
Time Complexity: O(N) Space Complexity: O(N)

Solution Code:


相关文章

网友评论

      本文标题:493. Reverse Pairs

      本文链接:https://www.haomeiwen.com/subject/taekoxtx.html