Viewing a single comment thread. View all comments

Philiatrist t1_jbyyqo8 wrote

There’s not a pretty way that I know of. You just could do:

{i | a_i in topk(A, 5)}

where topk is defined

topk(A, 1) = {max(A)}

topk(A, i + 1) = {max(A \ topk(A, i))} U topk(A, i)

You can modify the first expression to deal with duplicates.

−1