+ 1

I want to print the values of an array in every possible combination, how do I do that?

https://code.sololearn.com/cxYdoy58EL3A/?ref=app

12th May 2022, 11:22 AM
tim szarfenord
2 Answers
12th May 2022, 11:27 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 2
I would try heaps algorithm or quickperm algorithm. Both explained here: https://www.baeldung.com/cs/array-generate-all-permutations Johnson-Trotter is also possible but not really beginner friendly 😉 https://code.sololearn.com/cz8eU44ocu26/?ref=app
12th May 2022, 10:25 PM
Denise Roßberg
Denise Roßberg - avatar