I think I am suppose count number of times series does not follow rule.
So I tried something like:
def count_inversion(sequence):
sequence = list(sequence)
count = 0
for i in sequence:
if sequence[sequence.index(i)] - sequence[(sequence.index(i)-1)] != 1:
count = (count + 1)
return count
But it is not giving me correct answer and I can't figure it out what is wrong!
Created at: 2015/11/16 13:48; Updated at: 2015/12/01 15:20