Created
April 11, 2014 00:34
-
-
Save anonymous/10434404 to your computer and use it in GitHub Desktop.
"Implement an algorithm to determine if a string has all unique characters."
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
def is_str_unq(str) | |
h = {} | |
str.split("").each do |c| | |
if (h.has_key?(c)) | |
return false | |
else | |
h[c] = 1 | |
end | |
end | |
return true | |
end | |
puts is_str_unq(ARGV[0]) |
baweaver
commented
Apr 11, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment