From: botp Date: 2012-07-08T11:49:22+09:00 Subject: Re: Find that number is repeated more and less times in an array On Sun, Jul 8, 2012 at 8:32 AM, Joao Silva wrote: > => With 0 repeats found the number 1.3, etc. > => With 1 repetition was found the number: 4, etc. > => With 2 repetitions was found the number 5, etc. fire up irb or pry, and play w ruby, eg, > a. group_by{|x|x}.group_by{|x,y| y.size-1}.each_with_object({}){|(k,v),h| h[k] = v.flatten.uniq} => {0=>[1, 3], 2=>[2], 1=>[5, 4, 6]}