O(n) Approach to solve the palindrome problem

programming
Tags: #<Tag:0x00007f2428864388>

#1

{
while(start<end)
{
if(s[start]!=s[end])
return false;
start++;
end–;
}
return true;
}
int Solution::solve(string A) {
int start=0,end=A.length()-1;
while(start<end)
{
if(A[start]!=A[end])
{
if(checkPalindrome(A,start+1,end)||checkPalindrome(A,start,end-1))
return 1;
else
return 0;
}
start++;
end–;
}
return 1;
}