Skip to content

Instantly share code, notes, and snippets.

@habina
Last active August 29, 2015 14:02
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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
@monkerek
Copy link

tip: you could save the file with name like CareerCup1.1.py such that it highlights the grammar keywords in your code:)

@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