George George wrote: > Given an array of arrays for example > [["A", "B"], ["A", "B", "D", "C"], ["B", "D"], ["B", "C", "F", "E"], > ["C", "F"], ["C", "E"], ["G"]] > > what would be a nice way of "merging" the items that seem to already be > contained in another array. Try this: arr = [["A", "B"], ["A", "B", "D", "C"], ["B", "D"], ["B", "C", "F", "E"], ["C", "F"], ["C", "E"], ["G"]] arr = arr.flatten.sort str = arr.to_s.squeeze arr = str.split(//) This takes the array of arrays, flattens it into a single array and sorts it. Then turns it into a string so we can use the squeeze method that eliminates duplicate characters. Then it changes it back into an array. =) -- Posted via http://www.ruby-forum.com/.