int* masterMind(char* solution, char* guess, int* returnSize){ int* arr = (int*)calloc(2,sizeof(int)); int s_hash[26] = {0}; int g_hash[26] = {0}; int i; for (i=0; i<4; i++) { if (solution[i] != guess[i]) { s_hash[solution[i]-'A']++; g_hash[guess[i]-'A']++; } else arr[0]++; } for (i=0; i<26; i++) { if (s_hash[i] && g_hash[i]) arr[1] += (s_hash[i] < g_hash[i])? s_hash[i]: g_hash[i]; } *returnSize=2; return arr; }