I’m having a lot of trouble solving the “No repeats please” algorithm (Front End - Advanced Algorithm Scripting) and I was hoping someone could sheds some light on it for me.
I understand that I’m supposed to use Heap’s Algorithm and I have no issue understanding Heap’s on a conceptual level, but I have no idea how to implement it in JS. It looks like I have to recurse down multiple levels (ex: first recursion - output A, next recursion - output B, next recursion - output C, then spit out ABC), but then walk my way back up through each step of the recursion (ex: now that I’ve spit out ABC, I need to walk back one level of recursion and output C [instead of B], then next recursion - output B and spit out ACB) and that’s what I’m having trouble with.
I don’t understand how I’m supposed to go all the way through a set of recursions, then output a result, and then go back in time to the previous step or two in that set of recursions.
I need help.