All Questions
Tagged with palindrome time-limit-exceeded
20
questions
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 "...
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
...
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
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
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,...
3
votes
0
answers
2k
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 ...
-2
votes
1
answer
90
views
Find the first palindrome larger than the given number
Question
Input number of test cases.
Input each test case and output its next palindrome number.
Link: https://www.spoj.com/problems/PALIN/
Language Used: C++14 (gcc 6.3)
My code
...
7
votes
3
answers
3k
views
The Next Palindromic number
I have incremented an integer in the function nextpalin() and converted it into a std::string for finding whether it's a ...
2
votes
2
answers
10k
views
Count palindrome substrings
Given a string S, count and return the number of substrings of S that
are palindromes. Single length substrings are also palindromes. We
just have to count the substring that are palindrome.
...
3
votes
2
answers
175
views
Code Chef RAINBOW Palindrome
Problem
Determine whether an array is "Rainbow", i.e. it has the following
structure:
First a1 elements equal 1.
Next a2 elements equal 2.
Next a3 elements equal 3.
Next a4 elements ...
3
votes
1
answer
818
views
SPOJ: smallest palindrome larger than a given number
I am working on the SPOJ palindrome question. I'm using JAVA to solve it.
The problem:
A positive integer is called a palindrome if its representation in the
decimal system is the same when read ...
7
votes
4
answers
17k
views
Calculate the number of palindrome numbers in the given ranges
I've written a program that calculates all of the palindrome numbers in the given range, but the code is slightly slower than needed. I've tried to improve algorithmic complexity to the best of my ...
1
vote
1
answer
671
views
Project Euler #4 - Largest Palindrome Project - Python
I solved the HackerRank version of the Largest palindrome problem (similar to Project Euler 4) in Python:
Find the largest palindrome made from the product of two 3-digit numbers which is less than ...
4
votes
2
answers
613
views
Number of possible palindrome sequences
Here is the problem description from hackerearth.com:
Rohan loves Palindromes. Palindrome is a string that read same forward
and backward. For example abba is ...
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 ...