remove duplicates from sorted array i and ii