the solution for remove duplicateds from sorted array