Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Count Inversions by _flomingo_
def count_inversion(sequence):
count = 0
for i in range(len(sequence)):
for j in range(i+1, len(sequence)):
if sequence[j] < sequence[i]:
count += 1
return count
May 9, 2016