I want to find the largest additional array from a multidimensional array in ruby. I have a multidimensional array as follows:
array = [[1,20],[2,40],[5,100],[7,15],[9,22]]
I want the first element of the auxiliary array to have the largest second element, as in the above example. I want it to 5be as a result, because the second element of the auxiliary array [5,100]is the largest that is 100. The output will be 5.
And if more than one element is maximal than I want it all.
Example: array = [[1,20], [2,40], [5,100], [7,15], [9,22], [12,100]]
The conclusion in this case will be [5,12]
Thanks in advance.