Mental Model
Count how many pairs of numbers are out of order in an array. Each pair where a bigger number comes before a smaller one is an inversion.
Analogy: Imagine a line of people waiting by height. Every time a taller person stands before a shorter one, it's like an inversion. Counting all these pairs tells us how mixed up the line is.
Array: [2, 4, 1, 3, 5] Inversions: (2,1), (4,1), (4,3) Visual: 2 -> 4 -> 1 -> 3 -> 5 ↑ ↑ ↑ ↑ ↑