ruby on rails - RoR array -count identical elements-on including value -
how count idential values on after appending value in array
such that
a=[] a<<1 count of 1 1 a<<1 count of 1 2
thanks
you do:
a.select{|v| v == 1}.size
it's 1 solution
Comments
Post a Comment