Given a non-empty array, find the smallest length of a contiguous subarray that has the same degree as the array.