News

The problem can be efficiently solved using a modified Merge Sort algorithm. During the merge step, count the number of inversions based on the positions of elements in the two halves.