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

Writing palindrome in angularjs

I am learning how to use angularjs and just need a good place to start. I tried to write this simple app but cant get it working, so can someone help me fix it, and help point me in the right direction.
Jerad Hobgood
  • 49
  • 1
  • 1
  • 5
-1
votes
1 answer

Time Complexity of palindromic decomposition algorithm

Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. I wrote a logic to return palindromic decompositions of a string, I am having hard time in driving the…
KBR
  • 464
  • 1
  • 7
  • 24
-1
votes
2 answers

Why isn't my palindrome checker working?

I can't for the life of me get my code to work. It identifies palindromes correctly, but for some reason, some non-palindromes words get marked as palindromes. Not all, just sum. And biggest headache of all, I can't figure out the correlation…
-1
votes
1 answer

Determine if user input is a palindrome

#include #include #include #include using namespace std; //declare methods void transform(char *, char *); bool testPalindrome(char *); int main() { //declare c-strings and a boolean variable char…
Minhkhoa Vu
  • 19
  • 2
  • 6
-1
votes
4 answers

Substring index out of bounds

I am writing a simple program to find the longest palindrome in a string. What I'm doing is checking if each substring is a palindrome and then checking its length. If the length is greater than the previous length, then I have the new longest…
GreenSkies
  • 141
  • 1
  • 10
-1
votes
2 answers

How to check the number of palindromes in a sentence?

I am new here. I would be grateful for some help, I am trying to write a program to find the palindromes in a sentence, this is what i have so far. However, whenever I execute it, the palindrome count comes to zero and System.out.println in the for…
-1
votes
1 answer

recursive palindrome function

recursive palindrome function this is me solution of the question there a mistack in my solution the not palindrome part is not printing #include #include using namespace std; bool ispalindrome( char string1[],int length); int…
-1
votes
1 answer

Java giving error :incomparable types: boolean and int" even though both methods are boolean?

What Im trying to code is that a user inputs a number n and the program outputs all the numbers from 1 to n that are both prime numbers and palindrome numbers. I created a method for finding prime numbers and another for finding if a number is a…
bob
  • 21
  • 1
-1
votes
2 answers

palindrome StackOverflow Error

I tried to use recursion to solve the palindrome problem. I got a Exception in thread "main" java.lang.StackOverflowError at java.lang.String.substring(String.java:1969) at Main.isPalindrome(Main.java:160) However, I don't know how to fix…
sower
  • 71
  • 1
  • 5
-1
votes
4 answers

C++ palindrome function

Code #include #include using namespace std; bool isPalindrome(string str) { for(int i = 0; i <= str.length()-1; i++) { if(str[i] != str[str.length()-1-i]) { return false; } …
user5539363
-1
votes
8 answers

String palindrome without using built in functions

I want to make program for String palindrome without using built in functions. Below is the code i have tried so far : public class Palindrom { private static Scanner in; public static void main(String[] args) { …
Prashant Rai
  • 7
  • 1
  • 1
  • 2
-1
votes
2 answers

Why Visual Studio do not support variables for array size?

So this was a problem statement from CodeLeet to find the Longest Palindromic Substring. In the codeleet interface this solution works: class Solution { public: string longestPalindrome(string s) { int len = s.size(); int P[len][len];…
blackmamba591
  • 151
  • 2
  • 11
-1
votes
2 answers

C:Checking whether the string is Palindrome

Write a function that checks whether the string is palindrome. Must use recursive function and ignore spaces. I have done the first part but still not figure out how to ignore space. The following code is what I have tried already. #include…
Dave Nguyen
  • 129
  • 1
  • 1
  • 8
-1
votes
5 answers

Palindrome recursive function

I tried to write a recursive function that says if a string is a palindrome, but all I get is an infinite loop and I don't know what the problem is def isPalindrome(S): listush=list(S) #listush=['a', 'b', 'n', 'n', 'b', 'a'] …
Pythonist
  • 3
  • 1
  • 2
-1
votes
1 answer

Creating numbers to test for palindrome

i want to write a code to test for palindrome but that is not the main problem. the problem is the input n is a scaler . if n is 2, ill create a combination of two digits numbers and multiply them against each other. the resulting set of numbers is…
1 2 3
99
100