Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
3
votes
Accepted
Generating ordered n-tuples with k distinct elements
len = 10;
k = 10;
dfs[number_List] := If[Length[number] == len ,
If[
Length[Union[If[# < 10, #, 0] & /@ number]] == k,
Print[If[# < 10, #, 0] & /@number]
],
Do[
If[i <= 10,
…
0
votes
Working with tables: add new level of nested tables
It's just a DFS
ClearAll[dfs];
max = 3;
len = 3;
dfs[curVal_, curPos_, curSum_, cur_] := Which[
curSum > max || curPos > len, Return[],
curSum === max && curPos === len, Sow[cur] …
6
votes
Accepted
List of tuples without duplicates & repeated values
n = 2;
vals = {0, 1};
Tuples[vals, {n}] // DeleteDuplicatesBy[#, Sort] &
As the comment said
Tuples[vals, {n}] // DeleteDuplicatesBy[Sort]
Also works, more clear. …