Questions tagged [palindrome]
Any sequence of units (typically letters or numbers) that are read the same way forward or backward.
259
questions
3
votes
1
answer
381
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 (...
1
vote
1
answer
237
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] ...
3
votes
0
answers
229
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 + ...
4
votes
4
answers
297
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 ...
-1
votes
1
answer
74
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.
...
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:
...
4
votes
1
answer
231
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 '...
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 ...
4
votes
2
answers
499
views
Longest Palindromic Substring better approach
I have encountered to this question and applied a brute force algorithm off top of my head and couldn't find a better optimized solution.
I was hoping I could get some insight to implement a better ...
1
vote
1
answer
189
views
Check if given integer is a palindrome
This code checks if the given integer is a palindrome. If it is, prints given integer is a palindrome else, not a palindrome:
...
1
vote
4
answers
323
views
Read a palindrome of unknown length
I have a task to write the function:
int read_palindrome(); // input comes from stdin
which will read one line from standard input and returns 1 if the line is a ...
2
votes
1
answer
287
views
Find palindromes in circular rotated string
I'm trying to tackle a programming challenge to determine how many palindromes exist in a given string that is being rotated character by character. My solution works, but it's too slow, and I'm ...
10
votes
2
answers
504
views
Determining if a string can be permuted to a palindrome
I am going through Elements of Programming Interview by Aziz, Lee and Prakash one of the questions is how to determine if a string can be permuted to a palindrome. For example ...
2
votes
0
answers
213
views
Longest Palindromic Substring challenge
My code is a mix-up between dynamic programming with the HashMap and brute force with the way I reach out the results and substring. I don't know how to optimize my ...
4
votes
2
answers
104
views
Solve Project Euler #4 in PHP
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 product of two 3-digit ...