sorting a multidimensional array in ruby -
i have following array:
[["2010-01-10", 2], ["2010-01-09", 5], ["2009-12-11", 3], ["2009-12-12", 12], ["2009-12-13", 0]]
i want sort second value in each group , return highest one, want output 12
given input above.
update
i might add made array using to_a
, hash, if there away same hash better.
use on hash:
hash.values.max
if need highest element, there no need sort it!
Comments
Post a Comment