Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

Palindrome String

Input: S = "abba"Output: 1Explanation: S is a palindrome
int isPalindrome(string S)
	{
	    string st = S;
	    char temp;
	    int i=0, j= st.length()-1;
	    while(j>i)
	    {
	       if(S[i] != S[j])
	       {
	           return 0;
	       }
	       i++;
	       j--;
	    }
	    return 1;
	}
Source by practice.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #Palindrome #String
ADD COMMENT
Topic
Name
2+2 =