Length of the longest sequence of consecutive integers


Given an array of integers, the sequences we are looking for are formed of consecutive numbers from the array, but not with necessarily consecutive indices. The order of the indices must be ascending though.Consecutive in this context means numbers in increasing order, that differ by at most one unit (they can be equal). 1,2,3 are consecutive, but also 1,1,1,2,3 and 10,10,10