Count the inversions in an array — every pair where a larger element appears before a smaller one — the measure of how far the array is from being sorted.
Loading content...