remove duplicates from sorted array I & II