Questions tagged [palindrome]
Any sequence of units (typically letters or numbers) that are read the same way forward or backward.
259
questions
7
votes
3
answers
187
views
Euler - Largest Palindrome Product in Java
Having been going over the documentation, learning more of the subtleties of Java. I am now going over some basic Project-Euler solution code I wrote a little while back. Hoping I can pick up some ...
3
votes
2
answers
46
views
Ruby: Check for Palindrome (as Monkey-Patch on String-class)
I have written a method, which checks for Palindrome and attached it to the String-class.
Here's the code:
...
13
votes
10
answers
8k
views
Tests for palindromes in C and C++
A question I've been asked on interactive phone screens is to code a test to determine whether a string is
a palindrome or not. I am providing two examples here: one in C and one in C++. They both ...
3
votes
2
answers
67
views
Palindrome predicate
A standard beginner problem is to determine whether a particular input is palindromic, i.e. reads the same in reverse as it does forwards.
I thought it might be fun to provide a distinctly non-...
10
votes
6
answers
3k
views
Determining numeric palindromes
I am working on bettering my C# skills, and recently wrote this program to solve a projecteuler.net problem:
A palindromic number reads the same both ways. The largest palindrome
made from the ...
3
votes
2
answers
544
views
One Piece Treasure- Find the number of palindromic substrings in a large substring
I'm trying to solve the below question:
A string of characters X (all in lowercase) of length n is present. We can ask a query <...
3
votes
2
answers
4k
views
Finding the index of the character whose removal will make a palindrome
Before I get into describing by problem I'd like to point out I found this question under c++ tag. But the solution of that question is already implemented in my ...
4
votes
1
answer
125
views
Is Palindrom-function in Swift
Task is simply to write the classic isPalindrom-function.
Here's my implementation:
...
2
votes
3
answers
544
views
Recursive palindrome check
I'm trying to solve this which basically calls for a recursive palindrome check with some minor extra steps (Special characters and whitespace can be ignored). The test inputs' length can be 100000 ...
-1
votes
1
answer
75
views
4
votes
1
answer
323
views
Leetcode, longest palindromic substring
Here's a link
Given a string s, return the longest palindromic substring in s. A string is called a palindrome string if the reverse of that string is the same as the original string.
Example 1:
...
1
vote
2
answers
160
views
Making my DP algorithm faster - longest palindromic substring
The following code is my solution to a LeetCode question - find the longest palindromic substring. My code is 100% correct, it passed once but it took too long, and in most of the reruns I hit a "...
4
votes
2
answers
11k
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 ...
2
votes
3
answers
137
views
Find long palindrome multiplications in modern C++
I'm a former C# programmer, updating my rusty C++98 (perhaps I should try Rust instead) to modern C++20. My main goal is to get used to C++ standard library types and algorithms.
I chose to solve a ...
3
votes
6
answers
18k
views
Check if a given string can be a palindrome by altering some character without using a library function
I was asked in an interview to write code to check if a given string is a palindrome or can be a palindrome by altering some character without using library function.
My logic is to:
Compare 1st <...