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