Pergunta de entrevista da empresa AnaVation

Given a string, how would you check for duplicates efficiently.