In ruby, how do I test that one array not only has the elements of another array, but contain them in that particular order?
correct_combination = [1, 2, 3, 4, 5
Not exactly the best solution possible, but at least it's brief
(',' + [1, 5, 8, 2, 3, 4, 5].join(',') + ',').include?(',' + correct_combination.join(',') + ',')
The best solution possible would be to employ one of string searching algorithms on array but you would have to code it yourself, I don't think there's standard solution.