Search
 
SCRIPT & CODE EXAMPLE
 

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;
	}
Comment

palindrome string

const isPalindrome = (str) => {
    
    const preprocessing_regex = /[^a-zA-Z0-9]/g,
    processed_string = str.toLowerCase().replace(preprocessing_regex , ""),
    integrity_check = processed_string.split("").reverse().join("");
    if(processed_string === integrity_check) return true
    else return false
         
        }

//if you find this answer is useful ,
//upvote ⇑⇑ , so can the others benefit also . @mohammad alshraideh ( ͡~ ͜ʖ ͡°)
Comment

minimum characters to make string palindrome

string s;
    int len=0,i=1;
    cin>>s;
    int n=s.size();
    vector<int> LPS(n);
    LPS[0]=0;
    while(i<n)
    {
        if(s[i]==s[len]) LPS[i++]=++len;
        else
        {
            if(len==0) LPS[i++]=0;
            else len=LPS[len-1];
        }
    }
Comment

palindrome string

int isPlaindrome(string S)
	{
	    // Your code goes here
	    int flag =0;
	    int l=0;
	    int h=S.length()-1;
	    while(h>l){
	        if(S[l++]!=S[h--]){
	         return 0;
	        }
	    }
	    return 1;
	}
Comment

Palindrome String

Input: S = "abc" Output: 0Explanation: S is not a palindrome
Comment

PREVIOUS NEXT
Code Example
Cpp :: use set to get duplicates in c++ 
Cpp :: find factorial in c++ using class 
Cpp :: queue operations c++ 
Cpp :: operator overloading in c++ 
Cpp :: priority queue in cpp 
Cpp :: copy constructor for vector c++ 
Cpp :: c language all keywords in string 
Cpp :: hashset in cpp 
Cpp :: C++ pointer to base class 
Cpp :: c++ pointers 
Cpp :: how to set arrays as function parameters in c++ 
Cpp :: convert uppercase to lowercase 
Cpp :: c++ string example 
Cpp :: pragma HLS bracets 
Cpp :: vsearch c program stdlib 
Cpp :: C+++++++++++++++++++++++++++ JAVA 
Cpp :: vector insert to end 
Cpp :: creating large maps cpp 
Cpp :: how-to-read-until-eof-from-cin-in-c++ 
Cpp :: cplusplusbtutotrail 
Cpp :: C++14 (gcc 8.3) sample 
Cpp :: convert c++ to c online 
Cpp :: C++ Display a text 5 times 
Cpp :: second smallest element in array using one loop 
Cpp :: zsh: segmentation fault ./provided_files.exe erosion X . 
Cpp :: std::copy 
Cpp :: omp multiple reductions 
Cpp :: Buy 2 Get 1 Free codechef solution in c++ 
Cpp :: qt_invok 
Cpp :: c++ comments 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =