search in rotated array with duplicate