Count how many pairs of elements are out of order in a list.
Constraints
Example
>>> count_inversions([3, 1, 2]) 2 >>> count_inversions([5, 4, 3, 2, 1]) 10 >>> count_inversions([1, 2, 3, 4]) 0 >>> count_inversions([]) 0
Recent Submissions
No submissions yet — hit Run Tests to try!
Hints