Just a small note, maybe also consider implementing your algorithm using a while/for loop (if possible):
Edit: I hadn’t properly understood the issue, but this might be useful none the less
Just a small note, maybe also consider implementing your algorithm using a while/for loop (if possible):
Edit: I hadn’t properly understood the issue, but this might be useful none the less