Skip to main content

All Questions

Tagged with
4 votes
1 answer
1k views

Check if string is palindrome LeetCode

LeetCode 125 requires receiving a string and checking if it is a valid palindrome. I have done this and am confident with an int and a single word, but this question requires the use a of a sentence ...
stupidQuestions'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
1 vote
2 answers
2k views

Palindrome algorithm

This code could be better? This is the algorithm: Compare the 1st character to the last character Compare the 2nd character to the second last character and so on Stop when the middle of the ...
Pankwood's user avatar
  • 173
18 votes
8 answers
5k views

Project Euler Problem #4 - Palindromic number

The problem 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. Find the largest palindrome made ...
IvenBach's user avatar
  • 3,487
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 ...
Jianmin Chen's user avatar
  • 2,396
4 votes
1 answer
598 views

Leetcode 125. Valid Palindrome

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 ...
Jianmin Chen's user avatar
  • 2,396
2 votes
1 answer
6k views

Get all possible palindromes in C#

As the title says, the goal is to get all the possible palindromes of a string in C#: ...
Gentian Kasa's user avatar
  • 2,046
2 votes
3 answers
2k views

Palindrome algorithm in C#

I had an interview yesterday where I had to write an algorithm on the whiteboard for working out if a value is a Palindrome in C#. The pressure got to me a bit but I've written my version of it in ...
nick gowdy's user avatar
8 votes
3 answers
1k views

Project Euler 4: Largest palindrome product

This solves Project Euler 4: Largest palindrome product using C# (specifically, using LINQPad). Any and all suggestions for improvements to either the C# code or the math/algorithm are very welcome. ...
Phrancis's user avatar
  • 20.4k
4 votes
1 answer
435 views

Finding palindromes in C#

This is my first foray into OOP, so I'd appreciate any kind of advice! Here is the problem description: On the first line of the input, you will receive a number specifying how many lines of ...
M.Y. Babt's user avatar
  • 236
1 vote
1 answer
1k views

Longest palindrome in a given string using LINQ

Problem:I need to write an algorithm that will return length of longest possible palindrome from a given string. So if the input is aabbbccdfg Program output should be 7. //-->[cabbbac] Can someone ...
callee.args's user avatar
4 votes
2 answers
482 views

Number palindrome checker

My daughter, nine, recently had some homework looking at number palindromes. Part of the assignment was to take a number, reverse it, add the two together and repeat until she got a palindrome and to ...
Bob Tway's user avatar
  • 245
30 votes
9 answers
58k views

Check a string to see if it is a palindrome

I have written two code pieces to check if a given string is a palindrome: ...
Rohit's user avatar
  • 1,066
17 votes
3 answers
18k views

Return the largest palindrome from the string

Here is the question: find the largest palindrome from a string. Ex: ABCBAHELLOHOWRACECARAREYOUILOVEUEVOLIIAMAIDOINGGOOD Result: ...
Love's user avatar
  • 369
6 votes
4 answers
381 views

Determining whether a number is a palindrome

Can someone improve this for me? It seems ugly. The method should test whether an incoming number is a palindrome and return a Boolean result. ...
nkirkes's user avatar
  • 161

15 30 50 per page