mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-25 09:42:16 +08:00
Update
This commit is contained in:
@ -423,8 +423,8 @@ class Solution:
|
||||
if len(path) == k:
|
||||
res.append(path[:])
|
||||
return
|
||||
for i in range(startIndex,n - (k - len(path)) + 2): #优化的地方
|
||||
path.append(i) #处理节点
|
||||
for i in range(startIndex,n-(k-len(path))+2): #优化的地方
|
||||
path.append(i) #处理节点
|
||||
backtrack(n,k,i+1) #递归
|
||||
path.pop() #回溯,撤销处理的节点
|
||||
backtrack(n,k,1)
|
||||
|
Reference in New Issue
Block a user