Relative Content

Tag Archive for pythonrecursiondepth-first-searchbacktracking

python backtracking debug

This is a minimal reproducible code, so please do not concern about the meaningfulness of the code.
I want to input a list with one element, and return once it grows to length of 5. So I use a recursion to do it. But somehow the append and pop cause res variable to update unintentionally. Could you help me find why? Many thanks!