My issue
why am i not able to solve this question using xor operation ,why the answer is coming wrong ? please help
My code
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t--){
int n;
cin>>n;
string s1,s2;
cin>>s1;
for(int i=1;i<n;i++){
cin>>s2;
for(int j=0;j<10;j++){
s1[j]=s1[j]^s2[j];
}
}
int count=0;
for(int i=0;i<10;i++){
if(s1[i]=='1'){
count++;
}
}
cout<<count<<endl;
}
}
Problem Link: Weapon Value Practice Coding Problem