'No Repeats' Help needed

Why this is not working!!! I feel so dumb…

I don’t understand why the loop just stops permutating and prints ‘here1’ three executive times. What’s wrong about the logic?

Codes adapted from:


The codes from the reference works perfectly, I just changed the input of str to an array and it’s not working… someone please tell me why… Thank you!

It logs here1 three times to show how recursion works. You’ll notice that it also logs here0 three times.