Skip to content

Commit cdf5171

Browse files
authored
Update find-words-that-can-be-formed-by-characters.cpp
1 parent 9ef77f2 commit cdf5171

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

C++/find-words-that-can-be-formed-by-characters.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ class Solution {
2424
}
2525

2626
bool check(const string& word, const string& chars,
27-
const unordered_map<char, int>& count2) {
27+
const unordered_map<char, int>& count) {
2828
if (word.length() > chars.length()) {
2929
return false;
3030
}
31-
unordered_map<char, int> count1;
31+
unordered_map<char, int> curr_count;
3232
for (const auto& c : word) {
33-
++count1[c];
34-
if (!count2.count(c) || count2.at(c) < count1[c]) {
33+
++curr_count[c];
34+
if (!count.count(c) || count.at(c) < curr_count[c]) {
3535
return false;
3636
}
3737
}

0 commit comments

Comments
 (0)