532.Reverse Pairs

1.Description(Medium)

For an array A, if i < j, and A [i] > A [j], called (A [i], A [j]) is a reverse pair. return total of reverse pairs in A.

Example

Given A =[2, 4, 1, 3, 5],(2, 1), (4, 1), (4, 3)are reverse pairs. return3

Tags

Array Merge Sort

2.Code

Last updated