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

5 lines
167 B
Ruby

# 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