I am looking at the two functions SortBy
and ReverseSort
.
SortBy[{{1, 2, 3}, {2, 3, 1}, {3, 1, 2}, {2, 2}}, Last]
{{2, 3, 1}, {2, 2}, {3, 1, 2}, {1, 2, 3}}
How do I sort this by the last element, but in the reverse order? I want to get this:
{{1, 2, 3}, {3, 1, 2}, {2, 2}, {2, 3, 1}}
Reverse@SortBy[{{1,2,3},{2,3,1},{3,1,2},{2,2}},Last]
which gives{{1,2,3},{3,1,2},{2,2},{2,3,1}}
$\endgroup$ – Nasser Nov 5 '17 at 18:21