reads the string in then determines if the string is a palindrome

Solutions on MaxInterview for reads the string in then determines if the string is a palindrome by the best coders in the world

showing results for - "reads the string in then determines if the string is a palindrome "
Franklin
29 Jun 2017
1#include <iostream>
2using namespace std;
3 
4// Iterative function to check if given string is a palindrome or not
5bool isPalindrome(string str)
6{
7    int low = 0;
8    int high = str.length() - 1;
9 
10    while (low < high)
11    {
12        // if mismatch happens
13        if (str[low] != str[high])
14            return false;
15 
16        low++;
17        high--;
18    }
19 
20    return true;
21}
22 
23int main()
24{
25    string str = "XYXYX";
26 
27    if (isPalindrome(str))
28        cout << "Palindrome";
29    else
30        cout << "Not Palindrome";
31 
32    return 0;
33}
34
Wael
15 Oct 2018
1#include <iostream>
2using namespace std;
3 
4// Recursive function to check if str[low..high] is a palindrome or not
5bool isPalindrome(string str, int low, int high)
6{
7    // base case
8    if (low >= high)
9        return true;
10 
11    // return false if mismatch happens
12    if (str[low] != str[high])
13        return false;
14 
15    // move to next the pair
16    return isPalindrome(str, low + 1, high - 1);
17}
18 
19int main()
20{
21    string str = "XYBYBYX";
22    int len = str.length();
23 
24    if (isPalindrome(str, 0, len - 1))
25        cout << "Palindrome";
26    else
27        cout << "Not Palindrome";
28 
29    return 0;
30}
31
queries leading to this page
how many palindromes are there in the given string write a program that reads a string and check if the string is palindrome or notnumber of steps to make string palindromcheck number is palindrome and return not palindrome stringwrite a program to take string as input and check if this is palindromegiven a string s 2c check if it is palindrome or not write a function f that determine string is palindromegiven a string find if 0 i is palindromehow to check whether the string is palindrome or notwrite a program to find all the palindrome words in a string palindrome string examplepalindrome algorithm recursivecheck if a given string is palindrome or not 28using recursion 29function to test if a string is a palindrome returning booleanfind out if a given string is a palindromepalindrom 28stringrecursive solution palindrom pseudocodefind out palindromic substrings with in a string make a string palindromeprogram to check a string is palindrome or notcheck if string is palindrome or not if not then print every part of it such that it is a palindrome how to check whether a string is a palindrome or nothow to find all palindromic substrings of a stringpalindrome program in c 7c check if number or string is palindrome 7c 239 coding bytesdetect palindromegiven string is palindrome or notno of strings before this string are palindromeshow to find a palindrome in a stringpalindrome 3 you are given a string 2c write a program to find whether the string is palindrome or not number of palindromes in a stringcheck if string is palindrome using recursion in pythongiven a string 2c find all substrings that are palindromes find all possible palindrome of a stringcheck whether a given string s is a palindrome using recursion return true or false check palindrome recurisonprogram to vheck if string is palindromepalindrome main functionfind whether given string is a palindrome or notstring palindrome in recursivemake palindrome from stringpalindrome string meaningis palindrome recursionwhat is string palindromepalindromic stringcheck string palindrome using recursionpalindrome of number using stringcheck if string is palindrome recursivelyalgorithm to check string is palindrome or notcheck if a string can be rearranges into a palindromea palindrome can be defined as 22a string that reads the same fwap to find if a string is palindrome or not in c 2b 2b using static funtion and static mrmber palindrome without recursion c 2b 2bexamples of palindrome stringgiven a palindrome string make it non plaindromerecursive program to check palindrome stringwrite a program to check whether the given string is palindrome or not using dequeue c 2b 2b palindrome checker without recursionwhat is palindrome stringhow to check if a string is palindromepalindrome string using recursionarray of string palindrome or notpalindrome find strings truelogic for palindrome stringno of palindrome string with given charactersa program to check whether entered string is palindrome or notcheck for palindrome recursionhow to check if string is palindromeis string a palindromepalindrome of stringget a string as input and check the given string is palindrome or not without using built in function for compariso chegghow many palindromic substring in a palindromic stringc 2b 2b char palindrome recursivefind a string with n palindromuc substringsprograms based on palindrome string someone enters a string and check whether is it palindrome or not 2cwhich logic is used 3f29 asked palindrome using recursion c 2b 2bwrite a method that returns true if a string is a palindrome by using a stack how do you check if a given string is a palindrome 3fcheck if a given string is palindrome using recursioncheck a string is palindrome or notpalindrome recursive function c 2b 2bwhat is a palindrome string function 22ispalindrome 22 that takes a string 2c and returns a boolean value indicating whether the string is a palindromeusing stack how do you check if a string is a palindromegiven a string 2c write a function that checks if the input is a valid palindrome palindrome in programming stringcheck if string is palindrome using recursion in chow to find palindrome substring in a stringoutput and code of write program for string is palindrome or notwhat makes a string palindromefind all the palindrome using character of stringcreate a function that returnsa boolean wheather the string is a strick palindromicconstruct palindrome from a stringpalindrome check of string write a method to determine whether the input string is a palindrome or notwrite a program to find whether a given string is a palindrome or not program to check given string is palindrome or notconvert the given string to palindrome stringpalindrome string meanspalindrome of a stringgiven the string 2c check if it is a palindrome21 tell me how you would reverse a string 2f sort an array of nums 2f check a string is palindrome or not in java 3ffind palindrome using recursionprogram t check whether a string can be formed as palindromewrite program which checks if string is palindromewrite code to check if a string is palindrome or not 3fis a string with one character palindromepalindrome string logic what is string in palindromewap to print the given number and a string is palindrome or notpalindrone check using recursionstring is palindromeispalindrome function c 2b 2bwhich of the following will generate palindrome string 3f check the string is palindrome or notn number of string palindromescheck if different parts of the string is palindrome or notpalindrome string solutionfind all palindromes in a stringnumber of palindrome in a stringstring palindrome using recursion in cprogram to check if a string is a palindrome without using built in function recursion function to print palindromalgorithm to find palindrome in a stringedtermine whether string is a palindromefunction that returns true if the given string is a palindrome otherwise29 asked palindrome using recursionnumber of palindrome in a strinf 2a 40 param 7bstring 7d s string to check if it has a palindrome permutateprint all the possible palindromes in a given stringbool ispalindrome 28string str 29 recursionis string of length 1 a palindromereturn true if string is a palindromewrite a script to check whether the given string is a palindromechech if string is palindromeispalidrome c 2b 2b recursionis palindrome recursiveimplement a recursive java method to determine if a string hasfind substring that is palindromeis empty string a palindromeprint all palindromes in a stringstring palindrome atcodre mathematical condition for a string to be palindromeall possible palindromes in a stringhow to find a palindrome of a number no string manipulationprint all possible palindrome of stringreturn palinderom of stringwrite a funnciton its take a string and return palindrom numberprogram to check string is palindrome or notcheck whether the given string is a palindrome or not wap that takes a string as input and prints palindrome if the string is a palindrome a palindrome is a string that is the same after reversing it palindrome string regexcheck whether a string is palindrome or notpalindrome with string parameterscheck palindrome using recursionentered string is palindrome or not recursive solution palindrom pseudocode pythonewrite a function that checks if a string is palindrome recursively get a string as input and check the given string is palindrome or not without using built in function for comparison find substring palindromepalindromes string 12 write a program to check if a given string is a palindromehow to check if string is a palindromehow to check a string is palindrome or notto check string palindrome or not and reverse stringrecursive mthod to print single pallindromestring program to check palindrome using arraygenerate all palindromes of a stringcheck string is palindrome or nothow do you check if a given string is a palindrome2 write a program to check whether a given string is palindrome or not using recursion palindrome using recursion in c 2b 2bcheck if a given string is palindrome or not a palindrome is a string which is equal to the inverse of itself dartpalindrome string of length 4palindrom stringsmaller palindromes than a stringpalindromable stringhwo to find a palindrome string ifrom a stringfind if a string has a palindromechange characters of a string so that it does not contain a palindromepalindrome check using recursionhow many palindrome present in given stringprogram to check if string is palindromehow many loops are required to check if string is palindrome or not 22write down a function called ispalindrome 28char str 5b 5d 29 that returns 1 if the string is a palindrome 2c 0 otherwise 22 in chow many palindromes are there in the given stringhow to find a palindrome of a number not string manipulationpalindrome in python recursivecheck whether the string passed to the method is a palindrome or notwrite a function that determines if a string is a palindromewrite a recursive method and the accompanying main method to check whether a string is a palindrome or notis an empty string a palindromewrite a program to check whether a number is palindrome or not 28using while loop 29 check if a string can be made palindromecheck given string is palindrome or notfunction to check if a string is palindromeshort recursive c 2b 2b function that determines if a string s is a palindromeis a substring in a string is palindromegiven the string 2c check if it is a palindrome 3f write a program using function to find out the given string is palindrome or not palindromw stringwrite a program to check how may palindrome strings with different lengths exists int a given palindrome string check if palindrome is string c recursionhow to check to see if a string is a palindromeif it is possible to create a string that is not a palindromerecursive function to check if a string is palindromeuse static data member and static function to find if a string is pallindrome or not in c 2b 2binput a string and determine whether it is a palindromewrite a function that returns 1 if a string is a palindrome and 0 if not is palindrome string 22to indicate if the input string is a palindrome 2c which means 22write a program to check palindrome stringpalindrome recursion pythoncheck if two strings are palindrome loginall palindromic substrings in a stringcheck whether the string passed to the method is a palindrome or not return true if the string is palindrome 2c else return false given a string abc display all palindromes to the stringa palindrome is a string that reads the same from the left and from the right for example 2c is this dna sequence a palindrome using recursioncheck if a given string is palindrome using recursiwrite a function to take a string and return its palindromic score palindrome checker using recursionpalindrome string is palindrome c 2b 2b recursionc 2b 2b program to check if the character is in the string or not using recursionwrite a function to determine if a string is a palindrome pseudocodecheck for palindrome recursion psedocodecreate a function that returns true if a string is an almost palindrome and false otherwise code to check a palindrome of stringcreate palindrome from a stringto check string is palindrome or notwrite a function called show palindrome that takes a number as an argument and then returns a palindrome string palindrome string programsgiven a string 2c write a function that checks if the input is a valid palindromewrite a program to take a string input 2c and then check whether it is a palindrome or not usingpalindrome using recursion pythonpalindrome string programcan you write a code that will verify if a string is a palindrome or not 3fcheck if rotoation of string results in palindromea program to check whether entered string is palindrome or nochange one letter of string and check if it is palindromecode to check string is palindrome or notwrite a program to check number palindrome and string palindrome given a string 2c write a function that checks if the input is a valid palindrome for loopwrite a function to check if e2 80 9cnurses run e2 80 9d or any other given string is a palindrome get a string as input and check the given string is palindrome or not without using built in function for comparison cheggpalindrome program in c 7c check if string is palindrome check palindrome of a stringhow to check if a string is a palindromec 23 recursion palindromemake a string a palindromepalindrome recursion bffget the palindrome string from stringreturn a palindrome stringwap that takes a string as input and print palindrome if the string is a palindrome a palindrome is a string that is the same after reversing it palindrome string egprint all the possible palindromes of a given stringfind the number of substrings which are palindromewrite an algorithm that checks whether a given string s is a palindrome 28it reads the same way backward as forwards 29 for i in 280 floor 28 7cs 7c 2f2 29 29 3a if s 5bi 5d 21 3d s 5b 7cs 7c 1 i 5d 3a return false return truewrite a program to check whether a given string is palindrome or not palindrome stringhow to check if given string is not palindromestring is a palindrome or notimplement a class to find the reverse of a string and check if the string is a palindrome or not 3f for c 2b 2bpalimdrome stringpalindorme recursion c 2b 2bcheck palindrome 28recursive 29 check whether a given string s is a palindrome using recursion return true or false input format 3a string s output format 3a 27true 27 or 27false 27write a program to check the string is palindrome or not palindrome with recursion in c 2b 2bfunction to find longest palindrome in given stringpalindrome strings how many loops are required to check if string is palindrome or nothow to find number of all palindrome substrings in a stringprogram to check that the string is palindromewrite a program to find that given number or string is palindrome or not how to tell if a string can be a palindromenumber of palindrome from n stringsc 23 recursion palindrome array boola palindromic string from given stringcheck palindrome with recursionpalindrome without recursionwrite a script to find out string is palindrome or notwrite a recursive function which takes a word as the input and returns true 2ffalse depending on whether it is a palindrome write a program to check whether the given string is a palindrome or not write a function that determines if a text is palindromeis one length string a palindrome 3fstring is palindrome or notwrite a program to find whether the string is palindrome or not 2c using recursion in javascripthow many palindromes string can be formed from a given stringsa palindrome can be defined as a stringthe number of palindromes in the given stringgiven a string s check it it 27s palindrome return true if string is palindrome else return falsetest for palindrome number without a stringhow to check if a string is palindrome or notgiven string is palindrometesting palindrome a palindrome string is one which reads the same both forward and backward write a code that will find whether a given string is a palindrome or not string palindrome in c 2b 2b geeksforgeekspossible palindrome substrings in a stringpalindrome score of stringc 2b 2b palindrome recursivepalindrome of a string without using string functionsfind all the words in a string which are palindromepallindrome using recursionwrite program for string is palindrome or not write a program which reads a piece of text terminated by null character write separate function to check whether the string is palindrome or not check if string ic palindromicwrite a function to check whether a string is palindrome or not what is its time complexity 3fcheck if two strings are palindrome lognhow to check if string is palindrome prologhow many palindromes in a stringstring palindrome programexample of palindrome stringpalindrome in stringpalindrome substrings of stringpalindrome of a string using recursionwrite code to check a string is palindrome or not 3fgenerate palindrome strings from a stringgenerate palindrome strings of given lengthwrite a program to check if the given input string is palindrome or not 2c if palindrome then reverse it check if a string is palindromecheck whether a string becomes a palindrome by changing only one letter in itfind whether a string is a palindrome or notpalindrome program for string recursion palindromepalindrome recursion reversecheck the given string is palindrome or notpalindrome function recursivelycheck if the string is a palindromestring palindromestrings palindromeis string a palidromehow to check string is palindrome or notcheck whether string is palindrome or notwhat is a string palindromepalindrome time complexity using slicing 2c reverse and iterativelyfind number of palindrome stringsshort recursive c 2b 2b function that determines if a string s is a palindrome egghow to check if a string is palindrome or not using string builderfind strings to attach to make palindromecheck if astring is palindromeprogram to check whether string entered is a palindrome or not write a program to find whether the string is palindrome or not 2c using recursion to check string is palindrome or not by iterationwap to input a string and check it if it is a palindrome string using a string slicepalindrome rucussionchech palindrome recursivelyfinding palindromic substrings within a stringcheck string palindrome efficientlystring palindrome in c 2b 2b using recursionforming palindrome from a stringtest cases for palindrome stringcheck string palindrome for multiple stringwrite a function to determine if a string is a palindromechecking palindrome of a stringfunction to test if a string is a palindromeprogram to check palindrome stringcheck if a string is palindrome or notrecursive palindromecheck if string is palindromestring to become palindromepalindrome of number using string and size of the palindromeempty string is palindromeexample recursive function to check stringreturn palindromic substring in stringprint all the palindromes from the given stringcheck string palindromicwrite a program to check the palindrome string easycheck if string is a palindromepalindrome recursive function find all possible palindromes using characters of a given stringwrite a function to find if the given string is a palindrome or not return 1 if the input string is a palindrome 2c else return 0 recursive palindrome solutiongiven string is palindrome recursionif a string is palindrome print unduplicated partpalindrome strings examplesfind palindrome sub stringwrite program to check palindrome string without any string library functionall palindromes in a stringfind all the palindromes smaller than string show do you search for a palindrome in a string of charactersgiven a string such a way that every substring is a palindromerecursive solution palindrom pseudocode pythonhow to check if is plaindrome with recursion and stack javais single character string a palindromelongeest palindrome in a stringpalindrome recursionwrite a program to check if a string entered by the user is a palindrome string or not check palindrome for substringpalindromes in a stringis palindrome long stringpalindrom of stringfind the number of palindromes below a stringprogram to check if a string is a palindromefind palindrome in a stringwrite a recursive program to check if a string is a palindrome 3f the method returns a boolean to indicate if the string is a palindrome or not 5b4 pts 5dwhat is the time complexity of your algorithm 3f 5b2 pts 5dwrite a program to check if a number is palindrome or not 28use loop 29 string generate with no palindrome as a substringcheck if a string is palindrome using recursionprint all palindrome substrings in a stringcreate a function is palindrome 28s 29 that returns true only if the string s is a palindrome a string is a palindrome if it contains the same sequence of letters when read backwards write a function to find all the words in a string which are palindromeprogram to find the total number of palindrome in a given stringcodewriting 300 given the string 2c check if it is a palindrome find palindrome in stringdetermine if the dna sequence is a palindrome recursively c 2b 2bcheck palindrome recursive c 2b 2bpalindrome string arraysif palindrome is possible with given stringfastest way to check if string is palindromehow to check whether a string is palindrome or notfind all palindrome substring in a stringwrite a program for palindrome stringfind if a given string is palindrome or notpalindrome string examplescheck if a string is palindrome in o 281 29write the logic to check whether the given string is a palindrome or not 3fstring palindrome checkhow to use a stack to check if a string is a palindrome stringc 2b 2b check palindrome in a string using recursionc 2b 2b program to check if the character is substring or not using recursionwrite a function that determines if a string in a palindrome ispalindrome recursive c 2b 2bmake string palindromea string and the biggest palindrome hackerearthfind palindrome within a stringpalindrome using recursionpalindrome string practicepalindrome number in stringfunction that receives character array and determnes if its a palidromenumber of substrings which can be palindromegiven a string return all the palindromes that can be obtained by its charactersa function that determines if a string is a palindrome recursionreads the string in then determines if the string is a palindrome