programming-examples/ruby/Data_Structures/permutations_strings.rb

5 lines
167 B
Ruby
Raw Normal View History

2019-11-15 12:59:38 +01:00
# returns true if string1 and string2 are permutations of each other
def check_permutations(string1, string2)
string1.chars.sort.join == string2.chars.sort.join
end