Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
recursion solution in Clear category for Count Inversions by Cjkjvfnby
def count_inversion(sequence):
head, *tail = sequence
if tail:
return sum(head > item for item in tail) + count_inversion(tail)
else:
return 0
Sept. 29, 2014
Comments: