57
votes
I'm a palindrome. Are you?
Pyth, 3 bytes
_I_
Returns True or False.
Try it online!
How it works
...
50
votes
I'm a palindrome. Are you?
Python, 39 bytes
lambda s:s[::-1]==s#s==]1-::[s:s adbmal
Try it online!
Boring, but if there is shorter in Python it will be impressive.
35
votes
I'm a palindrome. Are you?
Jelly, 5 bytes
ḂŒ
ŒḂ
Returns 1 or 0. The first line is an unexecuted helper link, the second line calls the palindrome test.
Try it online!
34
votes
32
votes
Accepted
Watson-Crick palindromes
05AB1E, 10 7 bytes
Code:
Â'š×‡Q
Explanation:
To check if a string is a palindrome, we just need to check the input with the input, with ...
30
votes
Goodness Giza Golf!
Python 2, 48 47 46 bytes
lambda s:s[~len(s)/2:]in'987654321'>s==s[::-1]
Test it on Ideone.
How it works
In Python, a chained comparison returns True if and ...
25
votes
I'm a palindrome. Are you?
Jelly, 5 bytes
⁼ṚaṚ⁼
Try it online!
Equals reverse and reverse equals.
Or the more efficient yet less aesthetically pleasing:
...
24
votes
I'm a palindrome. Are you?
Haskell, 87 85 44 34 bytes
p=(==)<*>reverse--esrever>*<)==(=p
Explanation: ((->) a) is an instance of ...
23
votes
23
votes
I'm a palindrome. Are you?
Mathematica, 23 bytes
QemordnilaP;PalindromeQ
Not very interesting, but for the sake of completeness...
The above is a ...
22
votes
Goodness Giza Golf!
Perl, 39 37 42 39 + 1 = 40 bytes
Using a new method, I managed to cut down a huge number of bytes. Run with the -n flag. Accepts input repeatedly at runtime, ...
20
votes
User Appreciation Challenge #1: Dennis ♦
Jelly, 11 bytes
ŒufØAe€ØCŒḂ
Try it online!
Alternate versions:
ŒlfØae€ØCŒḂ
...
19
votes
Watson-Crick palindromes
Jelly, 9 bytes
O%8µ+U5ḍP
Try it online! or verify all test cases.
How it works
...
19
votes
I'm a palindrome. Are you?
PHP, 55 bytes
<?=strrev($s=$argv[1])==$s;#;s$==)]s[TEG_$=s$(verrts=?<
Try it online!
19
votes
Accepted
Yo boy, must it sum
Brachylog, 7 bytes
~+ℕᵐ.↔ᵐ
Try it online!
Surprisingly not that slow.
Explanation
...
18
votes
Heterograms, Palindromes, oh my!
Pyth, 17 bytes
Z.{rzZ.q.Zzr}.Z
Try it online here.
The leading space is necessary. I have counted it and the trailing space in the byte count.
Here's the ...
18
votes
User Appreciation Challenge #1: Dennis ♦
05AB1E, 9 bytes
žM¹álSåÂQ
Try it online!
-2 thanks to Adnan.
This attacks Jelly's pain point exactly. It uses l and ...
18
votes
User Appreciation Challenge #1: Dennis ♦
x86 32-bit machine-code function, 42 41 bytes
Currently the shortest non-golfing-language answer, 1B shorter than @streetster's q/kdb+.
With 0 for truthy and non-zero for falsy: 41 40 bytes. (in ...
17
votes
Heterograms, Palindromes, oh my!
Python 3, 125
The main problem is to make the reverse of the code parsable. Then we can let it error out from undefined identifiers.
...
17
votes
Palindromize this string!
Python 3, 41 bytes
lambda t:t+t[-2::-1]#]1-::2-[t+t:t adbmal
Try it here.
17
votes
I'm a palindrome. Are you?
MATL, 7 bytes
tPX=XPt
Try it online!
Returns [1; 1] for palindromic input and [0; 0] otherwise.
...
17
votes
Palindromic Primes without 11
Python 2, 76 73 72 70 69 68 bytes
n=input();c=k=m=11
while n:m*=k/c;k+=c;n-=`k`==`k`[::~m%k-c]
print k
Thanks to @WheatWizard for golfing off 3 bytes!
Thanks to ...
17
votes
Palindromic numbers with a binary twist
05AB1E, 7 bytes
b0Ü‚DíQ
Try it online!
or as a Test Suite
Explanation
...
16
votes
Palindrome Hello, World
TI-BASIC, 67 bytes
"!tenalP ,sgniteerG"
"Greetings, Planet!"
This works because the last line of a program is displayed on the screen, while the first string is ...
16
votes
16
votes
I'm a palindrome. Are you?
Pip, 12 11 bytes
Now comment-free!
x:RVaQaVR:x
Takes input as a command-line argument; outputs 1 for palindrome, ...
16
votes
Have you heard of tralindromes?
Regex (Perl / PCRE2 / Boost / Pythonregex), 59 47 46 38 37 33 32 bytes
^((.+)((.)(?3)\4|(?=\2$).?))?.?$
Try it online! - Perl ...
15
votes
Palindromizing the strings
Pyth (commit b93a874), 11 bytes
.VkI_IJ+zbB
Test suite
This code exploits a bug in the current version of Pyth, commit b93a874. The bug is that ...
15
votes
Accepted
Write a Palindrome-Polyglot-Quine
CJam/GolfScript, 2 languages, 50 bytes
{`"0$~e#"+0$-1%"":n}0$~e##e~$0}n:""%1-$0+"#e~$0"`{
Try it CJam!
Try it in GolfScript!
Huh, this went unanswered ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
palindrome × 99code-golf × 86
string × 31
number × 14
sequence × 13
decision-problem × 12
restricted-source × 10
base-conversion × 9
code-challenge × 8
math × 7
integer × 6
primes × 4
quine × 4
binary × 4
permutations × 4
source-layout × 4
number-theory × 3
tips × 3
date × 3
python × 3
polyglot × 3
subsequence × 2
balanced-string × 2
bitwise × 2
fastest-algorithm × 2