Solving Reverse Pairs in go. Please try yourself first to solve the problem and submit your implementation to LeetCode before looking into solution.

Problem Description

You need to return the number of important reverse pairs in the given array.


Input: [1,3,2,3,1]
Output: 2


Input: [2,4,3,5,1]
Output: 3


  1. All the numbers in the input array are in the range of 32-bit integer.

See the full details of the problem Reverse Pairs at LeetCode

Originally posted at: