remove duplicates in array in time O(n lg n) OK