Your task is to determine whether an array has the same sequence of numbers at the beginning and the end, and if so, how long that sequence is.
For example, the array
1 4 9 10 11 12 1 4 9
has the same sequence 1 4 9
at the left and the right, and it has length 3.
If the array doesn't have a common sequence at the left and the right, such as
1 4 9 16 25
return 0.
The two sequences cannot overlap. For example, in the array
1 1 1 1
the sequence 1 1
occurs at the left and the right, and your
method should return 2.