Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def makeArrayConsecutive2(sequence)
- sequence = sequence.sort
- x = 0
- array_length = sequence.length
- number = 0
- difference = 0
- while (x < array_length - 1)
- difference = (sequence[x + 1] - sequence[x]) - 1
- number = number + difference
- x = x + 1
- end
- return number
- end
Advertisement
Add Comment
Please, Sign In to add comment