If I have a list
A = {51, 2, 3, 4, 5, 6, 7, 52, 55};
How do I get the highest three numbers of A
to get
{51, 52, 55}
I can think of ranking them first, but is there a faster way to do this?
If the order does not matter, TakeLargest[A, 3]
; if it does, A[[Ordering[A, -3]]]
.
Sort[A][[-3;;]]
? $\endgroup$