in reply to Code to solve the "matrix formation" puzzle
In the inner loop, I think assigning to a hash is cheaper than deleting from it, so it might be better to assign 0 or undef instead of removing elements.
You mentioned not seeing an algorithm for permutations of n distinct numbers taken r at a time. You could use Algorithm::ChooseSubsets to select the elements, and then permute them with Algorithm::FastPermute.
|
|---|