Any sequence of units (typically letters or numbers) that are read the same way forward or backward.

learn more… | top users | synonyms

4
votes
3answers
73 views

Check for palindrome in singly linked list

Looking for code review, optimizations and best practices. Node.java ...
3
votes
1answer
53 views
1
vote
1answer
61 views

Checking if a single linked list is a palindrome in C++

The following is my first try at this classical interview question. It is quiet different from the solutions Gayle Laakmann provides in her book, and in another question on stackoverflow, someone ...
3
votes
5answers
137 views

Python palindrome checker

This is my palindrome-checker It is doing what it should do ...
2
votes
1answer
55 views

196-Algorithm Program

Attempting to see whether using 196 as a respectively in my program will have a result or not, I made a simple function to test it. Now the 196-Algorithm requires ...
2
votes
3answers
124 views

Reverse digits and add until a palindrome appears

The following code is a C solution to the following problem UVA 10018. The Problem The "reverse and add" method is simple: choose a number, reverse its digits and add it to the original. If ...
1
vote
2answers
113 views

Longest palindromes

I've been tasked to solve this exercise lately, and this is what I wrote: ...
2
votes
3answers
71 views

Find a palindrome using Ruby

I am preparing for an upcoming exam and have the following practice question.. Write a method to determine if a word is a palindrome, without using the reverse method. Most of you probably ...
8
votes
4answers
1k views

Program to Check If string is Palindrome (in C) [closed]

Just wrote a program to check if a string is Palindrome. If that's true, return 1. Else, return 0. How can I improve it? ...
3
votes
0answers
51 views

Determining if a genetic sequence is palindromic

Adding another level to my previous question on 'normal' palindrome identification, in this one I'm interested in identifying genetic palindromes. Here's my attempt: ...
4
votes
1answer
74 views

Determining if a sequence is a palindrome

To complement this Java question on palindrome identification, I came up with this C++(14) version: ...
5
votes
3answers
288 views

Project Euler #4 in C++: largest palindrome product of two 3-digit numbers

Project Euler #4 A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99. Find the largest palindrome made from ...
1
vote
2answers
93 views

Check if a linked list is a palindrome in O(n) time and O(1) space

I liked this problem because there are so many sub-problems that are interview problems in their own right-- (reverse linked list, find midpoint) ...
4
votes
1answer
55 views

Worst case runtime analysis of a string partitioning algorithm

Give all the partitionings of a string s such that every substring of the partition is a palindrome What is the time complexity of this solution? And, how can I improve my code overall? ...
3
votes
3answers
413 views

Integer Palindrome Check in C

This method should check whether a number is a palindrome or not: ...
17
votes
10answers
4k views

Palindromes in C

The function tests whether or not the provided string is a palindrome, and the main function just times how quick it is (after all, C's supposed to be quick, ...
6
votes
1answer
108 views

Next Palindrome

I've written a function which, given a number string, returns the next largest palindrome in string form. For example, if the input string is "4738", the output ...
5
votes
2answers
607 views

Find all distinct palindromic sub-strings for a given string

I was solving a question where I had to find all possible unique palindromes of size greater than 1 for a string. I was able to come up with the solution shown below. If I am not mistaken it is an ...
3
votes
1answer
126 views

Longest palindromic subsequence by memoization

I've written some code to solve the longest palindromic subsequence problem. ...
2
votes
3answers
92 views

Palindrome numbers - Project Euler Problem 4

Project Euler Problem #4: Largest palindrome product: A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99. ...
4
votes
2answers
382 views

Find palindrome in a string

The purpose of this code is to find the largest palindrome in a string. It works fine when the string is short, but every time I test this code with 1000+ characters in a string, it takes forever to ...
4
votes
1answer
121 views

Finding palindromes in C#

This is my first foray into OOP, so I'd appreciate any kind of advice! Here is the problem description: On the first line of the input, you will receive a number specifying how many lines of ...
4
votes
2answers
115 views

Palin Pairs (Pallindrome Counting) Code

In an array of strings 'a' having 'n' strings i have to select the Palin Pairs from the given strings .for ex for input 3 bba abb abb Output=2 I am getting correct output but want to reduce time ...
3
votes
3answers
85 views

Palindrome Validator

This code returns true if the sentence is a palindrome, and false otherwise. Is there a better way of doing this? ...
6
votes
4answers
572 views

Largest palindrome that can be made from a product of 2 3-digit numbers (Project Euler 4)

This is my solution to Project Euler #4, which asks for the largest palindrome that can be made from a product of 2 3-digit numbers. I have done a brute force method, but it takes around 10-20 seconds ...
2
votes
3answers
162 views

Removal of a character to make a string a palindrome

This code determines which index for a given string if that character is removed will produce a palindrome string. For eg s = "baa" After removing b the string "aa" is palindrome. Here ...
3
votes
3answers
2k views

Finding number of palindrome pairs in an array

I am trying to find the number of string pairs in an array that are palindromes. ...
3
votes
1answer
156 views

Project Euler 348: Sum of a square and a cube

Many numbers can be expressed as the sum of a square and a cube. Some of them in more than one way. Consider the palindromic numbers that can be expressed as the sum of a square and a cube, ...
7
votes
1answer
3k views

Finding all possible distinct palindromes of a string

There was some online test where I was asked about finding all possible distinct palindromes of a string. Here I had to give the count of all possible distinct palindromes of a given string ...
1
vote
2answers
96 views

Making numbers palindromic

This is a challenge I found here. You're suppose to list how many steps it takes to convert a number to a palindromic number, where each step consists of adding number to the reverse of itself. For ...
2
votes
1answer
540 views

Checking if any permutation of a string can make it palindrome

I was writing code to check if any permutation of a string can make it palindrome and came up with the following logic: ...
2
votes
3answers
115 views

HackersEarth - Reverse primes

Generate as many distinct primes P such that reverse (P) is also prime and is not equal to P. Output: Print per line one integer( ≤ 10^15 ). Don't print more than 10^6 integers in all. ...
11
votes
4answers
5k views

Palindrome Checker in Java

My objective is to take a string as input and determine if it is a palindrome. I'm wondering how I could improve this code (efficiency, bugs, etc). I'm relatively new to Java so I'm expecting that my ...
1
vote
2answers
94 views

Checking a numeric palindrome

Given A and B, count the numbers N such that A ≤ N ≤ B and N is a palindrome. Input: First line contains T, the number of testcases. Each testcase consists of two integers A and B in ...
4
votes
2answers
481 views

HackerRank challenge - index palindrome

I have a solution but it fails the performance for two tests. How can I speed it up? ...
8
votes
3answers
1k views

Project Euler #4 - Largest Palindrome Product in Java

I am seeing that this is actually not in accord with the difficulty level said there. Firstly I cannot list all possible improvements it could have. ...
4
votes
2answers
211 views

Largest palindrome in a string

I am working on a question in which I need to find a largest palindrome given a string. Here is the description. ...
3
votes
6answers
3k views

Largest palindrome made from the product of two 3-digit numbers

I am working on an interview question in which I need to find the largest palindrome made from the product of two 3-digit numbers. Here is the question. ...
2
votes
1answer
46 views

Palidrome checker in haskell

I decided to avoid the trivial isPalindrome lst = lst == reverse lst and tried writing a method with pattern matching and recursion. ...
1
vote
1answer
174 views

Longest palindrome in a given string using LINQ

Problem:I need to write an algorithm that will return length of longest possible palindrome from a given string. So if the input is aabbbccdfg Program output should be 7. //-->[cabbbac] Can someone ...
7
votes
4answers
2k views

Palindrome program

Given a beginning and ending point, check how many numbers are palindromic. My solution is a bit clunky. How could it be more elegant? ...
5
votes
1answer
301 views

STL-like palindrome checking

I just read this article on how to write a standard-like algorithm and wanted to try it myself by writing (as suggested in the article) an algorithm to test if a sequence given by two bidirectional ...
4
votes
2answers
415 views

Number palindrome checker

My daughter, nine, recently had some homework looking at number palindromes. Part of the assignment was to take a number, reverse it, add the two together and repeat until she got a palindrome and to ...
2
votes
1answer
1k views

Palindrome Checker with Stack

In my answer to this question, I wrote a new solution. Personally, I would not use a stack, but given that a stack was required, how good is this solution? In this solution, I add half of the word, ...
2
votes
4answers
353 views

Palindromes with stacks

I'm creating a simple function to verify whether or not a string is a palindrome, and must use stacks in solving it. ...
3
votes
3answers
573 views

Finding the next palindrome code

I have been trying recently to develop a code finding the next palindrome from a certain number. For example, if the input is 800, the output should be 808, as 808 being the next palindrome from 800. ...
10
votes
2answers
316 views

The finest integers are palindromes

Challenge: Reverse the digits of a number and add it to the original until the number is a palindrome Specifications: Your program should accept as its first argument a path to a filename. ...
2
votes
1answer
1k views

Producing a pyramid of capital letters

Now I'm reading C Premier Plus by Stephen Prata and there's an exercise 4 in chapter 6 which has no solution in the book, so I can't check if I did it properly. My code works like it should, but I ...
6
votes
2answers
673 views

Palindromes without character

You are given a string of lowercase letters. Your task is to figure out the index of the character whose removal will result in a palindrome. There will always be a valid solution. Here is my ...
3
votes
1answer
1k views

Check if string can be rearranged into a palindrome

I created a function to test whether a single word string can be a rearranged into a palindrome (doesn't have to be a real word). My logic was if the string has an even number of letters, then each ...