What\'s the most efficient way to test if an array contains any element from a second array?
Two examples below, attempting to answer the question does foods>
foods>
You can check if the intersection is empty.
cheeses = %w(chedder stilton brie mozzarella feta haloumi) foods = %w(pizza feta foods bread biscuits yoghurt bacon) foods & cheeses => ["feta"] (foods & cheeses).empty? => false