Amazon interview question

remove duplications in an array