Domanda di colloquio di AnaVation

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