What goes in the blank?
# permutations by backtracking
for x in choices:
if x in path:
continue
path.append(x)
dfs(path)
path.____() # undo the choice
Answer: pop
Backtracking undoes each choice after exploring it, so the shared path is clean for the next sibling.
Play Problem Solving ▸