4 ms·
Can't the Secret Santa problem be solved just by shuffling an array of participants, and assigning a person A[i] to give a gift to a person A[(i+1)%N]? I have
by selwtysaxoac 6y ago
Can't the Secret Santa problem be solved just by shuffling an array of participants, and assigning a person A[i] to give a gift to a person A[(i+1)%N]?
I have a feeling that this is not correct, but cannot determine why.
- adamc 6y agoDid you read the article? It adds constraints.
- selwtysaxoac 6y agoYes, I asked about the unconstrained problem. Sorry, I should have mentioned that.
- cochne 6y agoThis is true if there are no constraints, but the author mentions they introduce constraints like 'a person cannot give to their significant other' (or else it would be too hard to keep it a secret)
- rflrob 6y agoI think it can as well, unless you require constraints as in the article.