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

In C, my code to find the palindrome is either not printing out all the chars, missing a single char, or repeating chars?

I am working on homework and my assignment is to find the palindrome in the string. My code is not printing out all the chars or missing a char, or repeatedly printing chars. I tried to post as many details as possible on my code. I hope someone can…
serene
  • 19
  • 3
-1
votes
1 answer

How to pop half a stack onto another stack

Hey I'm working on a program using two stacks (created using array) to determine if a string is a palindrome. I have declared two stacks. The plan is to read in the string, one by one, and push them onto the first stack. Then, I will pop half the…
Tan Duong
  • 1
  • 2
-1
votes
2 answers

Questions regarding C++ string

phrase.erase(remove_if (phrase.begin(), phrase.end(), ::isdigit), phrase.end()); In the above code, why do I have to use :: even though I used using namespace std? #include "Palindrome.h" #include #include #include…
Tsz Yee Ha
  • 21
  • 3
-1
votes
1 answer

What's wrong or missing with my HTML and JS palindrome script?

function isPalindrome (userEntry) { str = str.toLowerCase; str = str.replace(/[^a-z]/g, ""); str = (i = 0 || i Your word is not a palindrome"; } } …
zhero1
  • 1
-1
votes
2 answers

The parameter 'num' should not be assigned (error)

I am a new coder in Java and I'm encounter a tutorial about Palindrome that is giving me an error "The parameter 'num' should not be assigned in the highlighted line 16. Can anyone take a look and offer some insight of what is causing this…
Samuel
  • 9
  • 2
-1
votes
2 answers

Generate palindrome words

So, I have this code which generates palindrome words in a special manner. 1> it joins the word by its reverse(excluding last character). 2> the words which end with repeated alphabets, for example ABB becomes ABBA and not ABBBA and XAZZZ becomes…
Vishwa Patel
  • 5
  • 1
  • 7
-1
votes
2 answers

Why isn't the program outputting true regardless of case?

My assignments requires me to keep accepting input from the user and output whether or not it is a palindrome until the word DONE is inputed. Also, words like Bob must have an output of true because we must disregard case (upper/lower.) This is my…
trap28
  • 97
  • 7
-1
votes
1 answer

Java Stack class / Palindrome class

Question: Develop a Stack class (NEEDS TO HAVE (at least) push, pop, and isEmpty methods) (The ONLY data structure you could use/have in your Stack class SHOULD be a CHAR ARRAY) Second, develop a second Java class named Palindrome that in its main…
Daniel
  • 3
  • 3
-1
votes
3 answers

Next Palindrome number

I want the final number as returned by the function, the following code is running, but not returning the correct value, the correct value is printed by the print statement above return satatement, how can return it ?? the correct answer is 22. but…
Arshad Shaikh
  • 23
  • 1
  • 4
-1
votes
5 answers

Program does not output numbers less than 5

I have a question to input a 5 digit integer. The program will output if it is a palindrome or not. And it will display "not a palindrome" if integer is not a palindrome. But the problem is that the program crash whenever i input a less than 5 digit…
-1
votes
1 answer

product of two 3 digit numbers a palindrome

I have written the following code for finding the first palindrome obtained by product of two 3 digit numbers: #include int main() { int pro,d,sum=0,c; for (int a=100;a<1000;a++) { for (int b=a;b<1000;b++) { …
-1
votes
2 answers

Longest Palindromic Substring on Java (leetcode)

In leetcode I tried to solve the "Longest Palindromic Substring" task. Here is the code: public String longestPalindrome(String s) { String str = ""; for(int i = 0; i < s.length(); i++) { for(int j = 1 + i; j < s.length() + 1;…
-1
votes
2 answers

What Am I doing wrong in this C program to check a string is Palindrome or not?

Following is the C program I wrote to check whether Entered string is Palindrome or not, but it always displays the 'else' statement i.e. The string is not Palindrome:- #include #include void main() { int i,n,count=0; char…
-1
votes
2 answers

Trying to refresh my coding. Palindrome excercise giving me an issue. Googled my error but cant fix it.

I'm working on a c++ exercise and honestly knowledge on strings is a little foggy and probably why this isn't working. I've forgotten a lot syntactically but I have a good foundational understanding of OOP in general. Just trying to get back into…
-1
votes
1 answer

FreeCodeCamp (JavaScript) Project Euler 4

I'm currently trying to find a solution for the Project Euler Problem 4 in Codecamp. This solution is working with 2 digits, but for 3 is gives instead of the correct result 90909 as answer. As I'm still new to JS I'm not able to find the problem.…
AtJack
  • 1
  • 1