> For the complete documentation index, see [llms.txt](https://junnie.gitbook.io/amazon-mock-interview/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://junnie.gitbook.io/amazon-mock-interview/onsite-iv/532reverse-pairs.md).

# 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. return`3`

[**Tags**](https://www.lintcode.com/en/problem/reverse-pairs/#tags)

[Array](https://www.lintcode.com/tag/array/) [Merge Sort](https://www.lintcode.com/tag/merge-sort/)

## 2.Code
