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
1 answer

Find a palindrome words in a string and then rewrite them, in C

Hi, how can i write a code in C that checks a string for palindromes, and then rewrites them? For example: string> "awbiue abdba aebto leoel", should return "abdba leoel". I wrote this code, but it can only find that the string is palindrome or…
Artiom J
  • 3
  • 2
-1
votes
1 answer

Palindrome case

I'm writing a function to check whether the integer is palindrome on Leetcode. Most of cases are acceptable. But there is a special case which is 10, why the output of my code return True. The idea for my code is convert integer to str and then…
QZhong
  • 1
  • 2
-1
votes
1 answer

Why String index out of range?

below is my code for Leetcode 9 Palindrome Number. It shows "String index out of range error" for line 8 when the testcase is 121. Can anyone tell me why this happened? Thanks! class Solution { public boolean isPalindrome(int x) { String…
Binky
  • 27
  • 5
-1
votes
1 answer

how to add this both original_text and reversed_text attributes in this class? how should I fix it to get the ideal outputs?

Below are the ideal outputs: ''' >>> palindrome = Palindrome('eye') >>> palindrome.original_text 'eye' >>> palindrome.reversed_text 'eye' >>> palindrome.is_palindrome() True >>> palindrome = Palindrome('dye') >>> palindrome.original_text 'dye' >>>…
PTP_XX
  • 59
  • 1
  • 7
-1
votes
1 answer

check whether the given string is palindrome using stack

I'm checking the palindrome using the stack. I want to receive input from the user, determine whether it is a palindrome, and output the result I want to ignore it without using a method of removing spaces and special characters, but it doesn't go…
user17213322
-1
votes
1 answer

Make a c program that will tell if a string is a palindrome(read the same way both ways) until BYE is encountered

Everything is working in my code but as soon as user inputs "BYE" my program is not ending i don't know why while loop is not responding to that code #include "stdio.h" #include int main(void) { char ch[20]; while (ch != "bye") …
-1
votes
3 answers

How do i fix this python reverse range palindrome?

This is for an assignment. We have to translate some provided java code into Python. Most of it was simple however the last bit is messing with my head. The whole code is a menu with one of the options being 'To display Palindromes up to 1000'.…
-1
votes
2 answers

Cant remove vowels from an array using filter that has multiple conditional statements

wordArr = ['a', 'g', 'e', 'f']; wordArr = wordArr.filter(function(l){ return l !== 'a' || l!== 'e'|| l!== 'i'|| l!== 'o' || l!== 'u'; }); My result: my wordArr doesnt change Desire output: ['g', f']; it only works with one…
solid_soap
  • 55
  • 1
  • 10
-1
votes
2 answers

Given a string s, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases

I have made the following code for the above program. In this program the test case "race a car" is not passing i.e. not showing the correct output for this test case. I don't know why. What's the reason? also if there is any way to correct…
vhvg vhcc
  • 19
  • 1
  • 5
-1
votes
1 answer

Why this Palindrome Recursive Function giving me True in all cases?

I have tried to write a recursive version of the Palindrome function. But it is giving me True in all the cases. why? def isPalindrome(inputString): if len(inputString)==0 or 1: return True elif inputString[0]==inputString[-1]: …
Pushpendra
  • 97
  • 1
  • 3
-1
votes
2 answers

Making a function to check if input word is a palindrome with Python with for and while loops

I'm trying to make a program that checks if user's input word is a palindrome and asks words until the input is a palindrome. My problem is that I can't get my program to print anything and could use some tips to fixing it. This is what I have so…
-1
votes
2 answers

palindrome program not working as expected

I know it's very puny thing for experts here but I want to check why my palindrome program is not working as expected, it shows as palindrome to every number or string i enter, can you please look into it where the issue is, please. actually i'm…
-1
votes
1 answer

Working of the interpreter in this program

This may sound like a stupid question but I had to ask. The following code checks whether a word entered by the user is a palindrome or not. When I use the below code, it says "This word is a Palindrome" for all the words. word = input("Enter a word…
-1
votes
1 answer

How does the back pointer move when using recursion to check a palindrome?

I have found a recursive solution to check whether a linked list is a palindrome: def isPalindrome(self, head: ListNode) -> bool: self.front_pointer = head def recursively_check(head): if head: if not…
hefu fhiwh
  • 105
  • 5
-1
votes
3 answers

Why am I getting "runtime error: Segmentation fault" for random test cases?

I'm asked to check whether a given string can be a palindrome after rearranging and then return true if it can be a palindrome or false if it cannot be a palindrome. I'm getting a runtime error: Segmentation fault while running tests. Here's my…
josh_3501
  • 15
  • 2