Qwilr interview question

Find the first non-repeated character in a string.

Interview Answers

Anonymous

22 Mar 2019

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

Anonymous

22 Mar 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.