correct_combination = [1,2,3,4,5] [1,5,8,5].function_name(correct_combination) # => false [8,10,1,9].function_name(correct_combination) # => true
我尝试使用include,但是用于测试[1,3] .include?(2)是否为真.
arr = [1,5].each_cons(arr.size).include? arr
在这种情况下,它适用于任何元素.