Find the longest sequence in an array