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

Popular posts from this blog

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

c++ - Convert big endian to little endian when reading from a binary file -