My issue
where is the problem in my code
can you help me find it
My code
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int n;
cin >> n;
for (int i=0; i<n; i++){
int N;
cin >> N;
char arr[N];
for (int j=0; j<N; j++){
cin >> arr[j];
}
if (N==1){
cout << 0 << endl;
continue;
}
bool flag = true;
for (int j=1; j<N; j++){
if (arr[j] == arr[j-1]){
flag = false;
cout << j << endl;
break;
}
}
if (flag){
cout << 0 << endl;
}
}
}
Problem Link: Alternating Binary String Practice Coding Problem - CodeChef