two solutions for remove duplicates from sorted array.