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
2
votes
2 answers

c - find palindrome

I'm a newcomer to programming, and I chose C as my first language(been learning it for a month or so). I've been trying to solve this palindrome question for hours and still couldn't come up with a satisfying solution. The question is here (from…
cdes58042169
  • 85
  • 1
  • 7
2
votes
1 answer

Find the largest palindrome made from the product of two n-digit numbers - python

I am solving this leetcode problem and the description goes like this, Find the largest palindrome made from the product of two n-digit numbers. Since the result could be very large, you should return the largest palindrome mod…
JJ123
  • 573
  • 1
  • 4
  • 18
2
votes
2 answers

Lisp - Flag(bandera) don't funtion

I'm trying to write a function to determine whether a word is palindrome or not. I make this but it always returns "Is not a palindrome". I don't know what is happening. (defun palindromo (X) (setq i 0) (setq j (- (length X) 1)) (setq…
2
votes
4 answers

Optimal verification if a number is Palindrom in JS

I have a problem I am sitting on for the past few days. I want to write an optimal (in JS) program for verifying if a number is a Palindrome. My current approach: function isPalidrom2(pali){ //MOST time consuming call - I am splitting the…
tzim
  • 1,715
  • 15
  • 37
2
votes
3 answers

Palindrome of int using lambda expression

Is there a better way to find an integer is palindrome or not using lambda expression. I tried something like this, it worked but looking for better approaches. public static boolean isPalindrome(int number) { return number ==…
2
votes
2 answers

What's the time complexity of this algorithm finding the longest palindromic substring?

Here's the Python code: def is_palindrome(s): return s == s[::-1] def longestp(s): if is_palindrome(s): return s maxp = s[0] for i in range(len(s)-1): half_length = len(maxp) // 2 start = i - half_length …
Eugene Yarmash
  • 142,882
  • 41
  • 325
  • 378
2
votes
1 answer

Why the list generated by a list comprehension is empty

First, sorry for my poor English and layout. I'm a Python beginner in China and this is the first question I've asked using English. Here's the question: I'm trying to generate palindrome number like 121 using filter(is_palindrome, range(1, 1000)).…
William
  • 27
  • 5
2
votes
2 answers

C# Palindrome Stack not working

i would like your help with my program. I'm trying to check if the user input is a palindrome. This is my code. Stack cstack = new Stack(); Stack rstack = new Stack(); Console.WriteLine("Enter a palindrome string"); …
nat1
  • 23
  • 4
2
votes
1 answer

Checking user input length (C programming)

I was working on a problem which was fairly simple but I came across an issue and was uncertain why the program was not working the way I wanted it to. The problem asked us to make a Palindrome test with and use functions. I was able to do all of…
comp
  • 41
  • 6
2
votes
2 answers

Palindrome C program convert capital letters to small letters

At school Im working on a palindrome C program. I'm almost done, but I would like my program to mark both 'Anna' and 'anna' as a palindrome. I tried some stuff out but nothing really worked. My code : #include #include int…
DeDaymar
  • 23
  • 4
2
votes
4 answers

The Palindrome words are not being properly displayed

package school; import java.util.*; public class PalindromeWords { boolean palindrome(String S) { String check=""; for(int i = S.length()-1;i>=0;i--) { check = check+S.charAt(i); } …
Uranium238
  • 21
  • 4
2
votes
1 answer

Bash - Count frequency of palindromes from text file

This is a follow up from my other post: Printing all palindromes from text file I want to be able to print to amount of palindromes that I have found from my text file similar to a frequency table. It'll show the amount of the word followed by the…
Jhonathan
  • 55
  • 5
2
votes
3 answers

Printing all palindromes from text file

I looked at this question: BASH Palindrome Checker. This is what the question answer shows from that thread: grep -E '^[a-z]{3,45}$' /usr/share/dict/words | while read -r word; do [ $word == `echo $word | rev` ] && echo $word; done; I…
Jhonathan
  • 55
  • 5
2
votes
5 answers

python and palindromes

i recently wrote a method to cycle through /usr/share/dict/words and return a list of palindromes using my ispalindrome(x) method here's some of the code...what's wrong with it? it just stalls for 10 minutes and then returns a list of all the words…
tekknolagi
  • 10,663
  • 24
  • 75
  • 119
2
votes
1 answer

Generate all possible combinations that are palindrome from a given string (Javascript)

I have a string 'racecarzz' and I would like to generate all possible combinations of each character from that string that can be read the same way backward and forward (Palindrome). Check for Palindromes is not difficult…
aznmunkey
  • 337
  • 1
  • 4
  • 7