Questions tagged [palindrome]
Any sequence of units (typically letters or numbers) that are read the same way forward or backward.
259
questions
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:
...
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
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-...
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 <...
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 "...
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
1
answer
262
views
Longest Palindromic Substring | Python Code Giving TLE
Problem Statement
Given a string s , return the longest palindromic substring in s.
Constraints
...
3
votes
3
answers
1k
views
The largest palindrome made from the product of two 3-digit numbers
Problem description:
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 the ...
1
vote
1
answer
66
views
isPalindrom-function in TypeScript
I have written an isPalindrom-Function in TypeScript.
...
0
votes
1
answer
38
views
Is my approach for Palindrome right or is there a better way to do it?
The code below is for checking whether the input string is palindrome or not
...
1
vote
1
answer
225
views
Find next biggest palindrome
I have written a program for the SPOJ PALIN problem:
A positive integer is called a palindrome if its[decimal representation is the same]from left to right and from right to left. For a given ...
1
vote
1
answer
115
views
Manacher Algorithm in Haskell
Please review the manacher algorithm in haskell. Find the longest Palindrome in a String.
...
1
vote
1
answer
362
views
Finding the next palindrome number
I wrote a piece of code that generates the next palindromic number and that works fine. However I feel like my code isn't as efficient as it could be. Are there any tweaks that I could implement to ...
7
votes
5
answers
986
views
Checking whether a string is a permutation of a palindrome in C++20 - follow-up
This post is the follow-up of Checking whether a string is a permutation of a palindrome in C++20.
So, what's new? Well, nothing else except that the procedure is now generic and accepts all ...
10
votes
4
answers
2k
views
Checking whether a string is a permutation of a palindrome in C++20
(See the next iteration/follow-up here.)
I have this short function is_permutation_palindrome, which returns true only if the ...
5
votes
7
answers
3k
views
Determine if a word is a palindrome
I'm a newbie programmer and was given a task to find if the input word is a palindrome or not. Now, I've written the program to the best of my ability but would like to know how it could be improved.
...
1
vote
1
answer
210
views
Finding longest palindromic substring in a string (gives TLE on leetcode)
I'm solving the Longest Palindromic Substring problem on LeetCode.
And here's my final submission:
...
1
vote
1
answer
89
views
Optimizing Code for Project Euler Problem 04
I just finished Problem 04 on Project Euler, and I was looking at ways to optimize my code, just started learning functions too, so I'm pretty sure it's very bad, hopefully you guys can help me.
...
4
votes
2
answers
168
views
Longest Palindromic Subsequence Multithread in C
I'm trying to learn how to multithread with c, and thought that the longest palindromic subsequence problem would be a good place to start.
The idea is that we run two threads and compare their ...
1
vote
3
answers
654
views
Finding n-th smallest Palindrome number (where 1<=n<=5000 and the palindrome number must have odd number of digits)
I am working on this code from 3 days from a website called Codechef, the code compiles, executes and even give correct results but my code is taking 1.01 sec, but the time limit for question is 1sec,...
1
vote
2
answers
260
views
Find largest palindromic substrings in a string
I have written some code to find the largest palindromic sub-strings in a string without repeating any character.
Example input
abappabaxhhh
output
...
0
votes
1
answer
325
views
Recursive Palindrome in JavaScript
Would someone review this code, and confirm that it is indeed recursive? I'm learning computer science and going through different types of algorithms. Right now, I'm focusing on recursion want to ...
0
votes
1
answer
95
views
Algorithm For Longest Palindrome
I made an brute force algorithm to find the longest palindrome within the string. This palindrome is a substring of the input. Below is the code.
...
4
votes
1
answer
1k
views
Check if string is palindrome LeetCode
LeetCode 125 requires receiving a string and checking if it is a valid palindrome. I have done this and am confident with an int and a single word, but this question requires the use a of a sentence ...
3
votes
1
answer
128
views
palindrome code in C times out in program challenge?
Hello I am making a code in C to find the value of the last sequence of palindromes of a specified size (d) and I need to optimize this code as it is for an ...
9
votes
1
answer
2k
views
LeetCode on Longest Palindromic Substring in Python
This is a programming question from LeetCode:
Given a string s, return the longest palindromic substring in s.
Example 1:
Input: s = "babad" Output: "bab" Note: "aba" is ...