Skip to content

Instantly share code, notes, and snippets.

@eduardopoleo
Last active August 17, 2017 12:22
Show Gist options
  • Save eduardopoleo/7793ee33b09dbe1b9df72b3aa3765c17 to your computer and use it in GitHub Desktop.
Save eduardopoleo/7793ee33b09dbe1b9df72b3aa3765c17 to your computer and use it in GitHub Desktop.
def unique_with_array(s)
char_set = Array.new
s.each_char do |char|
code = char.ord
return false if char_set[code]
char_set[code] = true
end
return true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment