Given an array
a
, return the length of the longest sequence that appears both at the front and back of the array. Given
[1 2 3 4 5 4 3 1 2]
the length of the longest sequence is
2
(the sequence
[1 2]
).