Let's say that I have some list:
lst = [[2,6],[1,4],[0,1],[1,1],[2,3],[0,2]]
I want to sort lst by the first element and for each sublist keep the one with the maximal second element when grouped by the first element.
So the results will be:
results
>>> [[0,2],[1,4],[2,6]]
Can someone kindly help me?