Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
simple double loop solution in Clear category for Count Inversions by Pouf
def count_inversion(sequence):
inversions = 0
for i,v in enumerate(sequence):
for k in sequence[:i]:
if k > v:
inversions += 1
return inversions
Oct. 22, 2014