From dda0b209263fea961185e8bb9a18262fa4af8f13 Mon Sep 17 00:00:00 2001 From: bqlin Date: Sat, 11 Dec 2021 23:34:11 +0800 Subject: [PATCH] =?UTF-8?q?0017.=E7=94=B5=E8=AF=9D=E5=8F=B7=E7=A0=81?= =?UTF-8?q?=E7=9A=84=E5=AD=97=E6=AF=8D=E7=BB=84=E5=90=88=EF=BC=9A=E6=9B=B4?= =?UTF-8?q?=E6=96=B0Swift=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- problems/0017.电话号码的字母组合.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/problems/0017.电话号码的字母组合.md b/problems/0017.电话号码的字母组合.md index 58508e08..b3bbf122 100644 --- a/problems/0017.电话号码的字母组合.md +++ b/problems/0017.电话号码的字母组合.md @@ -503,7 +503,7 @@ func letterCombinations(_ digits: String) -> [String] { var result = [String]() var s = "" - func backtracking(digits: [Int], index: Int) { + func backtracking(index: Int) { // 结束条件:收集结果 if index == digits.count { result.append(s) @@ -514,11 +514,11 @@ func letterCombinations(_ digits: String) -> [String] { let letters = letterMap[digits[index]] for letter in letters { s.append(letter) // 处理 - backtracking(digits: digits, index: index + 1) // 递归,记得+1 + backtracking(index: index + 1) // 递归,记得+1 s.removeLast() // 回溯 } } - backtracking(digits: digits, index: 0) + backtracking(index: 0) return result } ```