code for remove duplicates from sorted array