mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-05 22:59:31 +08:00
Update 0216.组合总和III.md
This commit is contained in:
@ -367,7 +367,7 @@ class Solution:
|
||||
|
||||
def backtracking(self, targetSum, k, currentSum, startIndex, path, result):
|
||||
if currentSum > targetSum: # 剪枝操作
|
||||
return # 如果path的长度等于k但currentSum不等于targetSum,则直接返回
|
||||
return # 如果currentSum已经超过targetSum,则直接返回
|
||||
if len(path) == k:
|
||||
if currentSum == targetSum:
|
||||
result.append(path[:])
|
||||
|
Reference in New Issue
Block a user