We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7078768 commit 6b0fea6Copy full SHA for 6b0fea6
algorithms/cpp/bullsAndCows/bullsAndCows.cpp
@@ -42,8 +42,8 @@ class Solution {
42
}
43
44
string getHint01(string secret, string guess) {
45
- int appears_in_secret[10], appears_in_guess[10], bulls[10];
46
- int total_bulls, total_cows;
+ int appears_in_secret[10] = {0}, appears_in_guess[10] = {0}, bulls[10] = {0};
+ int total_bulls = 0, total_cows = 0;
47
for(int i = 0; i < secret.size(); i++)
48
appears_in_secret[secret[i] - '0']++;
49
for(int i = 0; i < guess.size(); i++)
0 commit comments