Easy c++ solution using count


#1

int Solution::solve(string A) {
int n=A.size()-1;
int i=0,j=n;
int start=0,count=0;
while(i<j){

    if(A[i]!=A[j]){ 
        i++;
        if(count>0)i=start+1;
        count=0;
    }
    if(A[i]==A[j]){
        if(count==0) start=i;
        i++;
        j--;
        count++;
    }
}
return start;

}

Blockquote


#2

Your code is not giving correct answer at all.