remove duplicates from sorted array

Improved algorithm one pass