spacepaste

  1.  
  2. An array A consisting of N integers is given.
  3. A pair of integers (P, Q), such that 0<P<Q<N, is called a slice of array A.
  4. A slice is called bi-valued if it consists of at most two different numbers.
  5. I need a function that, given an array, A consisting of N integers, returns the size of the largest bi-valued slice in A.
  6.