My issue
include <bits/stdc++.h>
using namespace std;
define for(i,n) for(int i=0;i<n;i++)
void solve(){
int n;
string s,t;
int cnt1=0,cnt2=0;
cin>>n;
cin>>s>>t;
for(i,n){
if(s[i]==‘1’){
cnt1++;
}
}
for(i,n){
if(t[i]==‘1’){
cnt2++;
}
}
cout<<min(cnt2,cnt1)<<endl;
}
int main() {
int t;
cin>>t;
while(t–){
solve();
}
// your code goes here
}
My code
#include <bits/stdc++.h>
using namespace std;
#define for(i,n) for(int i=0;i<n;i++)
void solve(){
int n;
string s,t;
int cnt1=0,cnt2=0;
cin>>n;
cin>>s>>t;
for(i,n){
if(s[i]=='1'){
cnt1++;
}
}
for(i,n){
if(t[i]=='1'){
cnt2++;
}
}
cout<<min(cnt2,cnt1)<<endl;
}
int main() {
int t;
cin>>t;
while(t--){
solve();
}
// your code goes here
}
Problem Link: Team Formation Practice Coding Problem - CodeChef