:type nums: List[int] :rtype: int
(self, nums)
| 42 | |
| 43 | class Solution(object): |
| 44 | def reversePairs(self, nums): |
| 45 | """ |
| 46 | :type nums: List[int] |
| 47 | :rtype: int |
| 48 | """ |
| 49 | _base = [] |
| 50 | |
| 51 | result = 0 |
| 52 | |
| 53 | for i in range(len(nums)-1,-1,-1): |
| 54 | index = bisect.bisect_left(_base, nums[i]) |
| 55 | result += index |
| 56 | bisect.insort_right(_base, nums[i]*2) |
| 57 | |
| 58 | return result |
| 59 |
nothing calls this directly
no outgoing calls
no test coverage detected