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

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

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -