Given a string, return the first NON-repeating character that occurs in the string. EX: "adzbdcab" returns 'z'.
Sigiloso
Okay, idk WTF wrong with y'all. This "lastIndexOf" has a runtime of O(m*n) based on the KMP algorithm. You CANNOT use it! You're essentially having an O(n^2) solution! Here's a solution WITH hashing (faster than a hash table too!) def non_repeating(string): if(string is None): return None hash_table = [0] * 256 for char in string: hash_table[ord(char)] += 1 for char in string: if(hash_table[ord(char)] == 1): return char return None