Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def permutationShift(permutation)
- array_length = permutation.length
- x = 0
- max = 0
- min = 0
- while (x < array_length)
- difference = permutation[x] - x
- if difference > max then
- max = difference
- end
- if difference < min then
- min = difference
- end
- x = x + 1
- end
- return max - min
- end
Advertisement
Add Comment
Please, Sign In to add comment