I read of a job interview question to write some code for the following:
Write an efficient function to find the first nonrepeated character in a st
I think the worst case is O(n^2) but looks clear for me:
def firstNonRep(word): """the first non-repeating character in a string: "ABCA" -> B """ for (i, c) in enumerate(word): residual = word[i+1:] if not c in residual: return c