12. Quiz N
(similarEnds)
An array has similar N-ends if the front and back N numbers are
in the reversed order.
Return the largest N value for which an array has the same N-ends.
- N is a positive integer.
- Give 0 if the ends are not similar at all.
Examples:
similarEnds([20,30,40])=>0.similarEnds([20,30,4,5,30,20])=>2.similarEnds([20,30,40,50,50,40,30,20])=>8. The repeating segments overlap.similarEnds([10,20,30,20,10])=>5.
Last modified February 17, 2022: AP CS Array unit - cleanup and organization. (d3e09c6)