remove duplicates from sorted array

two problems, important, review them later.