Skip to content

Commit c77d682

Browse files
authored
Update letter-combinations-of-a-phone-number.cpp
1 parent c259b13 commit c77d682

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

C++/letter-combinations-of-a-phone-number.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ class Solution {
1616
}
1717
vector<string> result;
1818
for (int i = 0; i < total; ++i) {
19-
int k = i, base = total;
19+
int base = total;
2020
string curr;
2121
for (const auto& digit : digits) {
2222
const auto& choices = lookup[digit - '0'];
2323
base /= size(choices);
24-
curr.push_back(choices[(k / base) % size(choices)]);
24+
curr.push_back(choices[(i / base) % size(choices)]);
2525
}
2626
result.emplace_back(move(curr));
2727
}

0 commit comments

Comments
 (0)