From: Jean-Julien Fleck Date: 2010-04-06T22:02:02+09:00 Subject: Re: Find a set of common elements from a multi-dimensional array Hello, 2010/4/6 Shreyas Satish : > I have a multi-dimensional array ; a=[[2,3,4],[1,3,4],[1,2],[1,2,3,4]] > i've to compare all the 4 sub-arrays and get common elements.Next,take 3 > subarrays at a time and get common elements.then take 2 sub arrays at a > time and get common elements. Have a look to Array#combination to group your subarrays into comparison sets and then use the Set class (require 'set') and it's intersection instance method to get the common elements. Cheers, -- JJ Fleck PCSI1 Lycée Kléber