Questions tagged [palindrome]

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

Filter by
Sorted by
Tagged with
3 votes
2 answers
492 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 <...
driver's user avatar
  • 212
4 votes
1 answer
104 views

Is Palindrom-function in Swift

Task is simply to write the classic isPalindrom-function. Here's my implementation: ...
michael.zech's user avatar
  • 4,142
2 votes
3 answers
461 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 ...
YaMiN's user avatar
  • 125
-1 votes
1 answer
69 views

Palindrome string program [closed]

...
THE BLACKSMITH's user avatar
4 votes
1 answer
268 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: ...
watch-this's user avatar
1 vote
2 answers
82 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 "...
ela16's user avatar
  • 113
2 votes
3 answers
119 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 ...
Thomas Weller's user avatar
3 votes
1 answer
231 views

Longest Palindromic Substring | Python Code Giving TLE

Problem Statement Given a string s , return the longest palindromic substring in s. Constraints ...
Rohit Singh's user avatar
3 votes
3 answers
922 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 ...
Amir Motefaker's user avatar
1 vote
1 answer
64 views

isPalindrom-function in TypeScript

I have written an isPalindrom-Function in TypeScript. ...
michael.zech's user avatar
  • 4,142
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 ...
Rahul Shivsharan's user avatar
1 vote
1 answer
214 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 ...
mhay10's user avatar
  • 39
1 vote
1 answer
96 views

Manacher Algorithm in Haskell

Please review the manacher algorithm in haskell. Find the longest Palindrome in a String. ...
presci's user avatar
  • 249
1 vote
1 answer
246 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 ...
mhay10's user avatar
  • 39
7 votes
5 answers
972 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 ...
coderodde's user avatar
  • 27k
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 ...
coderodde's user avatar
  • 27k
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. ...
Manya Garg's user avatar
1 vote
1 answer
137 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: ...
Joe D's user avatar
  • 113
1 vote
1 answer
79 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. ...
fabinfabinfabin's user avatar
4 votes
2 answers
159 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 ...
AKRA's user avatar
  • 155
1 vote
3 answers
577 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,...
Prince's user avatar
  • 125
1 vote
2 answers
225 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 ...
user786's user avatar
  • 145
-1 votes
1 answer
262 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 ...
andrewlundy's user avatar
0 votes
1 answer
93 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. ...
Akash Patel's user avatar
4 votes
1 answer
792 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 ...
stupidQuestions's user avatar
3 votes
1 answer
113 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 ...
Yuri Nogueira Moreira da Silva's user avatar
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 ...
user avatar
4 votes
4 answers
1k views

Check if a binary tree is symmetric in Python

I have solved the following Leetcode problem. Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree [1,2,2,3,4,4,3] is symmetric....
user82261's user avatar
  • 169
3 votes
2 answers
629 views

Palindrome Algorithm and JUnit 5 Tests

I have a "Palindrome" class that has some functions for verifying if certain things are Palindromes. For the verification, I have 2 different algorithms, one being recursive and the other ...
George R's user avatar
  • 221
2 votes
4 answers
920 views

Python palindrome checker function

For practice purposes I implemented a function that checks for palindromes: ...
dicomp's user avatar
  • 41
3 votes
1 answer
648 views

Optimizing code solution for Palindrome Index-Hackerrank

I submitted my solution for palindrome Index coding challenge but I get "test cases terminated due to time out error". My code is working and so I don't know what else to do to optimize it. Please ...
R. Wanjohi's user avatar
3 votes
0 answers
1k views

HackerRank's Challenging Palindromes solution times out for certain tests

I am trying to solve the Challenging Palindromes problem from HackerRank. The code that I have got so far fails only for large inputs due to timeout, every other test it passes successfully. The ...
Atul Vani's user avatar
3 votes
1 answer
81 views

A fast generator of palindrome dates in chronological order

02/02/2020 is a palindrome day because reading the date left-to-right or right-to-left still refers to the same calendar date. And because it doesn't matter whether you use the DD/MM/YYYY format or ...
Sep Roland's user avatar
  • 4,288
9 votes
5 answers
3k views

Palindrome checker program

I've been studying Java for some days and I'm just now starting to make some simple programs, I'd like to know if there's any 'noob' mistakes or habits that I could avoid. In other words: how could ...
Tlomoloko's user avatar
  • 627
7 votes
2 answers
2k views

Python palindrome program

I have written a palindrome program. And I was just wondering if it correct? I checked using the words racecar and madam, and it says they are palindromes. I have also tested nonpalindrome words and ...
Austin V Nguyen's user avatar
1 vote
0 answers
112 views

How do I optimize memoization in order to find longest palindromic substring?

I want to find the longest palindromic substring using dynamic programming in Python3. The strings can be as large as this string. I have seen other questions on this problem that successfully solve ...
Aviral Srivastava's user avatar
3 votes
0 answers
202 views

Longest palindrome code in C# takes time out on LeetCode

I like to request a review of the code below, which is my attempt at answering the question here on LeetCode site. The code passes 43 tests, but it times out on the next one. I copied and ran the test ...
Shahin's user avatar
  • 103
0 votes
3 answers
112 views

Basic Palindrome check comparing chars

I've seen variations of this assignment where you reverse a string to match it to the original to find out if it is a palindrome, but this version I made only iterates through half of the string ...
Gemtastic's user avatar
  • 675
6 votes
3 answers
919 views

CTCI Chapter 1 : Palindrome Permutation

Below is my code for the problem 1.4 in CTCI. I would like a review of my code and if my approach to the problem is correct. Problem Statement: Palindrome Permutation: Given a string, write a ...
tripma's user avatar
  • 61
3 votes
1 answer
253 views

Project Euler - Problem No.4 - Largest palindrome product

according to the problem: 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 ...
Omri Shneor's user avatar
4 votes
3 answers
2k views

Palindrome test

This is some code that determines if a string of characters is a palindrome or not. My professor says that there is a performance issue with the program, but I can't quite put my finger on it. Can ...
Avantika P's user avatar
3 votes
2 answers
634 views

Calculate the largest palindromic number from the product of two 6-digit numbers (100000 to 999999)

Are there any efficient ways to solve this problem, for example using bitwise operator? ...
Selman Keskin's user avatar
3 votes
1 answer
367 views

Palindromic partitions solution

Task Find the smallest number of cuts required to break a string into a set of valid palindromes. For example: ababbbabbababa becomes a|babbbab|b|ababa (cuts = 3) partytrapb becomes partytrap|b (...
EML's user avatar
  • 2,033
1 vote
1 answer
214 views

Palindrome Pairs

The task is taken from leetcode Given a list of unique words, find all pairs of distinct indices (i, j) in the given list, so that the concatenation of the two words, i.e. words[i] + words[j] ...
thadeuszlay's user avatar
  • 3,973
3 votes
0 answers
225 views

Longest Palindrome Substring: Where is the dynamic programming? [closed]

In this LeetCode problem, Longest Palindromic Substring, it is listed under Dynamic Programming for Google interview preparation. My understanding of dynamic programming is roughly "recursion + ...
Scott Skiles's user avatar
4 votes
4 answers
287 views

Largest Palindrome Product - Project Euler #4

This is my code for Project Euler Problem #4 The question: 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 ...
Eagle's user avatar
  • 255
-1 votes
1 answer
73 views

Why does my function think that "uiouioiu"is a plaindrome? [closed]

I was reading Introduction to Computation and Programming using Python and there in an exercise, we had to write a function which would tell us if a given word is a palindrome or not, recursively. ...
user avatar
6 votes
3 answers
2k views

Determine whether an integer is a palindrome

The task Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. Example 1: Input: 121 Output: true Example 2: ...
thadeuszlay's user avatar
  • 3,973
4 votes
1 answer
199 views

Return whether a string is a palindrome if you can delete at most k elements

The task: Given a string which we can delete at most k, return whether you can make a palindrome. For example, given 'waterrfetawx' and a k of 2, you could delete f and x to get '...
thadeuszlay's user avatar
  • 3,973
11 votes
5 answers
1k views

Easy to read palindrome checker

I made a palindrome checker that's supposed to be designed to be simple and easy to read. Please let me know what you think. I believe the time complexity is \$\mathcal{O}(n)\$ but I'm not too sure ...
DreamVision2017's user avatar

1
2 3 4 5 6