Pergunta de entrevista da empresa Qwilr

Find the first non-repeated character in a string.

Respostas da entrevista

Sigiloso

22 de mar. de 2019

The easiest way is to add characters to a map if not already contained in the map (or set).

Sigiloso

22 de mar. de 2019

Oops someone pointed out to me it’s non-repeated. Easy with a map. Two pass. First pass count the occurrence of characters. Second pass check the counts. Stop on the first character count == 1.