IBM interview question

remove duplicates