programming-examples/ruby/Data_Structures/unique_characters.rb
2019-11-15 12:59:38 +01:00

11 lines
204 B
Ruby

def unique_characters(text)
visited_characters = Set.new
text.each_char do |character|
return false if visited_characters.include? character
visited_characters << character
end
true
end