Created
May 24, 2018 14:49
-
-
Save BrianLitwin/d2c8d03cd15304bb41030d693ef0fabe to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func isUnique(string: String) -> Bool { | |
var charSet = Set<Character>() | |
for character in string { | |
guard charSet.contains(character) == false else { return false } | |
charSet.insert(character) | |
} | |
return true | |
} | |
// if charSet.contains(character) { | |
// return false | |
// } else { | |
// charSet.insert(character) | |
// } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment