All Questions
16 questions
2
votes
3
answers
553
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 ...
3
votes
1
answer
131
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 ...
3
votes
0
answers
235
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 ...
8
votes
3
answers
2k
views
Leetcode 125. Valid Palindrome (better performance?)
Problem statement
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.
For example,
"A man, a plan, a canal: Panama" is a ...
2
votes
1
answer
565
views
Project Euler #4 - finding the largest palindrome from the product of two n-digit numbers
Project Euler Problem #4: "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 ...
6
votes
1
answer
889
views
Palindromes that are sum of consecutive squares
I have been working on a Project Euler: 125, which took me ages to solve. The problem and source are cited below
The palindromic number 595 is interesting because it can be written as
the sum of ...
3
votes
2
answers
400
views
Largest palindrome product
From the Project Euler challenge series:
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 ...
6
votes
1
answer
503
views
Next Palindrome
I've written a function which, given a number string, returns the next largest palindrome in string form. For example, if the input string is "4738", the output ...
3
votes
1
answer
870
views
Project Euler 348: Sum of a square and a cube
Many numbers can be expressed as the sum of a square and a cube. Some of them in more than one way.
Consider the palindromic numbers that can be expressed as the sum of a
square and a cube, ...
2
votes
3
answers
531
views
HackersEarth - Reverse primes
Generate as many distinct primes P such that reverse (P) is also prime
and is not equal to P.
Output: Print per line one integer( ≤ 10^15 ). Don't print more than
10^6 integers in all.
...
10
votes
2
answers
624
views
The finest integers are palindromes
Challenge:
Reverse the digits of a number and add it to the original
until the number is a palindrome
Specifications:
Your program should accept as its first argument a path to a filename.
...
1
vote
3
answers
615
views
Optimizing Project Euler 36 - double-base palindromes
This one was quick and simple. Any optimizations?
...
25
votes
5
answers
2k
views
Count distinct primes, discarding palindromes, in under 2 seconds
Problem Statement
Generate as many distinct primes P such that reverse (P) is also prime
and is not equal to P.
Output:
Print per line one integer( ≤ 1015 ). Don't print more than
106 ...
7
votes
2
answers
2k
views
Lychrel calculator (Project Euler 55)
If we take 47, reverse and add, 47 + 74 = 121, which is palindromic.
Not all numbers produce palindromes so quickly. For example,
...
2
votes
6
answers
2k
views
The Next Palindrome - reducing total execution time
I tried to solve one SPOJ problem. I wrote one program in Python, however, it got accepted by the SPOJ judges, but its total execution time is 2.88s. The same algorithm used in C language having ...