3
$\begingroup$

I would like to find the positions of multiple occurrences of a minimum value in a list. For instance, for the list {1, 2, 1, 3}, I want to obtain the two positions for the occurrences of the number 1.

MinimalBy[{1, 2, 1, 3}, id (x)] gives me these occurrences, but not the positions.

$\endgroup$
4
$\begingroup$
lst = {1, 2, 1, 3};
Random`Private`PositionsOf[lst, Min @ lst]

{1, 3}

Also

 Flatten@Position[lst, Min @ lst]

{1, 3}

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.