Unique Elements
BitMaps
[False, False, False, False, True]def is_unique(text):
# BitMap of chars
char_set = [False for _ in range(128)]
for char in text:
val = ord(char)
if char_set[val]:
# Char already in string
# so it's not unique
return False
char_set[val] = True
return TrueLast updated