Skip to main content

All Questions

6votes
1answer
408views

Palindrome insertion challenge

Here is my solution to the following Daily Coding Problem challenge: Given a string, find the palindrome that can be made by inserting the fewest number of characters as possible anywhere in the word....
2votes
1answer
167views

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 ...
5votes
3answers
401views

Project Euler #4: palindromic number

The problem statement for Project Euler Problem 4 is as follows: A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99. ...
4votes
1answer
330views

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: ...
3votes
3answers
1kviews

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 ...
9votes
1answer
2kviews

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 ...
4votes
4answers
1kviews

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....
3votes
1answer
282views

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 ...
25votes
5answers
2kviews

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 ...
4votes
2answers
8kviews

Reverse and Add: find a palindrome

This is one of codeeval challenges Challenge Description: Credits: Programming Challenges by Steven S. Skiena and Miguel A. Revilla The problem is as follows: choose a number, reverse ...
6votes
2answers
771views

Counting ways to divide a word into palindrome blocks

I wrote this program as a solution to the 2015 British Informatics Olympiad question on "block" palindromes. Brief overview of the task: A palindrome is a word that shows the same sequence ...
4votes
2answers
617views

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 a ...
1vote
1answer
676views

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 ...
7votes
6answers
2kviews

Generalized Project Euler #4: Largest palindrome from product of two n-digit numbers in Python

This solves Project Euler 4: Largest palindrome product using Python (not limited to 3 digit numbers). I need suggestions for improvements to either the Python code or the math/algorithm since time of ...
3votes
1answer
2kviews

Hackerrank Funny String python solution

"Funny String" problem from Hackerrank Suppose you have a String, \$S\$ of length \$N\$ indexed from \$0\$ to \$N-1\$. You also have some String, \$R\$, that is the reverse of \$S\$, where \$S\$ is ...

153050per page
close