My issue
include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t–){
int n;
cin>>n;
int a[100];
for(int i=0; i<n; i++){
cin>>a[i];
}
int count=0;
for(int i=0;i<n;i++){
if(a[i]==a[i+1]){
count++;
}
}
if(n%2==0){
cout<<n-count-1<<endl;
}
else{
cout<<n-count<<endl;
}
}
} what is the hidden test case error in this question
give me that
My code
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t--){
int n;
cin>>n;
int a[100];
for(int i=0; i<n; i++){
cin>>a[i];
}
int count=0;
for(int i=0;i<n;i++){
if(a[i]==a[i+1]){
count++;
}
}
if(n%2==0){
cout<<n-count-1<<endl;
}
else{
cout<<n-count<<endl;
}
}
}
Problem Link: Card Removal Practice Coding Problem