diff --git a/Algorithms/17. Letter Combinations of a Phone Number/main.swift b/Algorithms/17. Letter Combinations of a Phone Number/main.swift index 5af37c0..ba2880e 100644 --- a/Algorithms/17. Letter Combinations of a Phone Number/main.swift +++ b/Algorithms/17. Letter Combinations of a Phone Number/main.swift @@ -24,34 +24,34 @@ class Solution { var results = [String]() for i in 0.. [String] { + func combinations(_ results: inout [String], _ digit: Int) { let candidates = Solution.mapping[digit] if results.isEmpty { - return candidates + results.append(contentsOf: candidates) + return } - var newResults = [String]() - for r in results { - + let count = results.count + for i in 0..