Given an array arr, we say that two elements arr[i] and arr[j] form an inversion if arr[i] > arr[j] and i < j. Find the total number of inversions in the array.
- An array of integers
arr.
- An integer representing the inversion count.
- 1 <= arr.length <= 10^5
- 1 <= arr[i] <= 10^6
Input: arr = [2, 4, 1, 3, 5]
Output: 3
Explanation: The inversions are (2, 1), (4, 1), and (4, 3).