...

/

Challenge: Inversion Count in an Array

Challenge: Inversion Count in an Array

Calculate the number of inversions in an array.

What is the inversion count?

Inversion count represents how far or close an array is from being sorted. If an array is sorted, the inversion count will be 0. But if it’s sorted in the reverse order, the inversion count will be maximum.

Consider indices i and j, ...