Skip to content

Instantly share code, notes, and snippets.

@habina
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save habina/aeb70fa03ad97d370c5a to your computer and use it in GitHub Desktop.
Save habina/aeb70fa03ad97d370c5a to your computer and use it in GitHub Desktop.
1.1 Implement an algorithm to determine if a string has all unique characters. Whatif you cannot use additional data structures?
def uniqueString(str):
"Return True if the string has all unique characters."
allChar = []
for i in range(256):
allChar.append(True)
for char in str:
if(allChar[ord(char)]):
allChar[ord(char)] = False
else:
return False
return True
@habina
Copy link
Author

habina commented Jun 16, 2014

Thanks for telling me that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment