Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Just another boring solution solution in Clear category for Count Inversions by borisuvarov
def count_inversion(sequence):
"""
Count inversions in a sequence of numbers
"""
counter = 0
position = 1
for number in sequence:
for num in sequence[position:]:
if number > num:
counter += 1
position += 1
return counter
Aug. 13, 2015