n = 2;
vals = {0, 1};
Tuples[vals, {n}] // DeleteDuplicatesBy[#, Sort] &
Some explanations:
The key is: you "sort" the list to see whether they are duplicate.
So I use Sort
to be DeleteDuplicatesBy
's condition.
n = 2;
vals = {0, 1};
Tuples[vals, {n}] // DeleteDuplicatesBy[#, Sort] &
Some explanations:
The key is: you "sort" the list to see whether they are duplicate.
So I use Sort
to be DeleteDuplicatesBy
's condition.