remove duplicates from sorted array, merge special case to return.