3 ms·
We just generate them on the fly - after all we're not stupid ;-) https://en.wikipedia.org/wiki/Permutation#Algorithms_to_generate_permutations https://en.wiki
by dmichulke 8y ago
We just generate them on the fly - after all we're not stupid ;-)
https://en.wikipedia.org/wiki/Permutation#Algorithms_to_generate_permutations https://en.wikipedia.org/wiki/Permutation#Algorithms_to_gene...
.. and there
"Generation in lexicographic order"
This algorithm only requires you to hold the last permutation in memory to obtain a new (distinct) one.