Skip to main content

Questions tagged [palindrome]

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

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
772 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
  • 231
2 votes
4 answers
984 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
696 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
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 ...
Atul Vani's user avatar
3 votes
1 answer
83 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,448
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
  • 637
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
126 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
226 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
122 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
954 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
271 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
689 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

15 30 50 per page
1 2
3
4 5
18