From: "pauldacus@..." Date: 2005-10-19T07:41:58+09:00 Subject: Re: AND THE WINNER IS... [WAS] Re: How to get non-unique elements from an array? Yes... my solution seems to suck in that it doesn't work & is slow. I believe this makes me Management Material! But hopefully I can redeem myself with this humble solution (does seem to work), which borrows heavily from my predecessors: one = {}; two = {}; a.each{|i| one[i] ? two[i]=1 : one[i]=1}; two.keys It uses the much acclaimed one-pass method, but skips the 'uniq' method, which seems like it's got to be expensive on a big array. No sorting or counting, just a straight up "If this is not the first time I've seen this thing, then it's the second, otherwise... it's the first". I'd benchmark, but a copy/paste on previous code blows up. I blame Windows.