We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 007885a commit 2e68100Copy full SHA for 2e68100
C++/guess-the-word.cpp
@@ -32,17 +32,17 @@ class Solution {
32
int find_guess_with_most_frequent_chars(
33
const vector<string>& wordlist,
34
const vector<int>& possible) {
35
- vector<int> count(26);
+ vector<vector<int>> count(6, vector<int>(26));
36
for (int i = 0; i < 6; ++i) {
37
for (const auto& p : possible) {
38
- ++count[wordlist[p][i] - 'a'];
+ ++count[i][wordlist[p][i] - 'a'];
39
}
40
41
int guess = 0, max_score = 0;
42
43
int score = 0;
44
45
- score += count[wordlist[p][i] - 'a'];
+ score += count[i][wordlist[p][i] - 'a'];
46
47
if (score > max_score) {
48
max_score = score;
0 commit comments