回溯算法模板
result=[]
def backtrack(路径,选择列表):
if 满足结束条件:
result.append(路径)
return
for 选择 in 选择列表:
做出选择
递归执行backtrack
撤销选择
思路(图源于leetcode,比较直观,方便回忆)