remove duplicates from sort array II sol2 not good way but a general way