check if a string is a palindrome
int length = myString.Length;
for (int i = 0; i < length / 2; i++)
{
if (myString[i] != myString[length - i - 1])
return false;
}
return true;
check if a string is a palindrome
int length = myString.Length;
for (int i = 0; i < length / 2; i++)
{
if (myString[i] != myString[length - i - 1])
return false;
}
return true;
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;
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us