Questions tagged [palindrome]

A word, phrase, number, or other sequence of units that may be read the same way in either direction, forward or backward.

A word, phrase, number, or other sequence of units that may be read the same way in either direction, forward or backward.

Spacing and punctuation is generally ignored when attempting to determine whether the potential palindrome under consideration is in fact a palindrome. One such example is:

I, madam, I, made radio - so I dared! Am I mad? Am I?

(from http://www.joe-ks.com/palindromes.htm)

1763 questions
-1
votes
2 answers

the largest palindrome made from the product of two 3-digit numbers. using c .whats wrong in my code?

Program not working, not giving output, I don't know what to do, where the problem is. I'm trying to find out the largest palindrome made from the product of two 3-digit numbers. #include main() { int i, k, j, x; long int a[1000000],…
-1
votes
1 answer

Dealing with trailing newline when checking for palindromes

I was trying to import a palindrome function from a previously made code. Initially the palindrome code was working properly, but after I imported it, it is not showing correct answer. import re def check(string): if (string==string[::-1]): …
-1
votes
1 answer

how do i solve this stack overflow error?

i am writing a function in which to check that the given array is a palendrome or not using recursion. int pal(char p[], int i, int j) { if (i > j) return 1; if (p[i] != p[j]) { return 0; } pal(p, i++, j--); } void palTest() { char…
Abo Ali
  • 81
  • 5
-1
votes
2 answers

program to determine palindrome is only executing the else condition

I am trying to get the palindrome of a string and below is my code. The problem is, it is only executing the else condition public class Palindrome { public static void main(String[] args) { String name = "aba"; StringBuilder…
-1
votes
1 answer

Valid Palindrome solution in Python not working

I'm working on a solution for finding a valid palindrome, where an empty string would be considered a valid palindrome. This question ignores any cases which are not alphanumeric. Following are some examples: Input: "A man, a plan, a canal:…
-1
votes
2 answers

Checking if a word is a palindrome

I am writing a function to check if a word is a palindrome def palidrome(b): word = ''.join(reversed(b)) if b == word: return True return False def main(): so = input("Please enter a matching word") come =…
Adil Ali
  • 7
  • 5
-1
votes
3 answers

To check each word in a sentence whether they are palindrome or not

In a given sentences, reverse each word and print the reversed words in the sentences. if there is a palindrome print those words .if there is no palindrome print "No Palindrome". this is what i wrote import java.util.Scanner; public class main{…
-1
votes
1 answer

Highest Value Palindrome

Given a string representing the starting number and a maximum number of changes allowed, create the largest palindromic string of digits possible or the string -1 if it's impossible to create a palindrome under the contstraints. I wrote a code who…
Nicholas
  • 39
  • 6
-1
votes
2 answers

C++ Argument of type "char" is incompatible with parameter of type "const char"

My instructor asked me to make a program using cstring that checks if program is palindrome. why its giving me "Argument of type "char" is incompatible with parameter of type "const char" error. #include #include #include…
Albert
  • 33
  • 1
  • 3
-1
votes
2 answers

Is it possible to check if word stored on stack is palyndrome without ANY additonal data structures in C++

In C++ programme, let's analyse stack data structure. My question is : Is it possible to check if the given stack contains palindrome or not WITHOUT ANY additional data structure and without modifying the stack? You are allowed to decompose the…
user6279077
-1
votes
1 answer

I am not getting desired output what is the problem in the code

Given a string. Find the longest palindrome subsequence. The string contains an only lowercase letter. Here, I am creating the array with the length of 26 and keeping track of all lowercase letters (i.e how many times they occur in the string).…
-1
votes
2 answers

I have to make a pyramid of letters in the middle of the screen i am able to print the pyramide but can not seem to get the alphabet and to go in

https://i.stack.imgur.com/5rpBR.png https://i.stack.imgur.com/ZH04N.png def full_pyramid(rows): print('\nFull pyramid...\n') for i in range(rows): print(' '*(rows-i-1) + '*'*(2*i+1)) string =" " reversed_string =…
arnie0505
  • 3
  • 2
-1
votes
3 answers

Palindrome Coding issue

Writing a program: Input string from the user print out whether this string is a palindrome or not Also, I found a few other codes online but want to work with this code only.m Please let me know the error i = str(input()) for item in i: …
-1
votes
1 answer

Can you have a boolean expression repeat in a while loop?

I have found a way to make my program recognize if something is a palindrome or not, but when it is not, the program will not repeat. I already have the boolean section of this implemented before my provided code. Originally was set with if…
-1
votes
1 answer

Palindrome Number: what is wrong with my code?

I am writing code in c++ to detect if an input number is a Palindrome Number, which means its reverse is the same as the origin. I have problems computing the reverse int. e.g. 121 returns true; 123 returns false; 12321 returns true; 10 returns…
Erin
  • 83
  • 1
  • 9