# Taking Out Max List from List of Lists

I have a list like this:

L1 = {{500, {x->3, y-> 4, z -> 1}}, {110, {x->11, y->41, z -> 9}}, {750, {x-> 1, y->-1, z->0}}}


Is there a way to pull out the element with the largest element in the first position? So, in this case, we would have returned:

{750, {x-> 1, y->-1, z->0}


Thank you.

• MaximalBy[L1, First] or Last@Sort@L1 – OkkesDulgerci Oct 30 at 4:29

You can use a combination of Part and Ordering:

L1[[Ordering[L1[[All, 1]], -1]]]


{{750, {x -> 1, y -> -1, z -> 0}}}

or a combination of Part and OrderingBy:

L1[[OrderingBy[L1, First, -1]]]

{{750, {x -> 1, y -> -1, z -> 0}}}


For large lists the first approach is faster.