remove duplicates from sorted array. if return result array.