From: Robert Klemme Date: 2005-10-16T21:52:00+09:00 Subject: Re: How to get non-unique elements from an array? para.hsu@gmail.com wrote: > Hello! > > How about this ? > (0...a.length-1).select{|i| a[i]==a[i+1]}.map{|i|a[i]}.uniq a needs to be sorted for this to work. As far as I remember that was not a guaranteed precondition so you would have to add that here. IMHO most efficient variants are still those that use a hash for element counting. Kind regards robert