Function first_non_consecutive

Source
pub fn first_non_consecutive(arr: &Vec<i32>) -> Option<i32>
Expand description

Your task is to find the first element of an array that is not consecutive. If the whole array is consecutive then return null. The array will always have at least 2 elements and all elements will be numbers. The numbers will also all be unique and in ascending order. The numbers could be positive or negative and the first non-consecutive could be either too!

ยงExample

[1,2,3,4,6,7,8]
returns 6