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
Simple Python3 solution
def findFirstUniqueChar(s): d = {} for c in s: if c in d: d[c] += 1 else: d[c] = 1 for c in s: if d[c] == 1: return s.index(c) return -1