3 ms·
I was recently dumbfounded by the fact that ()() is not a palindrome, but ())( is. It's obvious, sure, but it still doesn't look right.
by kiliankoe 8y ago
I was recently dumbfounded by the fact that
()()
is not a palindrome, but
())(
is. It's obvious, sure, but it still doesn't look right.
- luizfzs 8y agoIt's not obvious for me (maybe you are joking and I didn't get it)
- kiliankoe 8y agoTry substituting other symbols, which makes it easier to see. 1 for ( and 0 for ) for example. Then we have 1010 and 1001
- luizfzs 8y agomindblow
- abababba 8y agoTry replacing ( with a and ) with b : abab -> not palindrome abba -> palindrome
- kiliankoe 8y agoFor a second I thought you have the most fitting username ever for this discussion, but then I saw that your account has just been created :D
- sombremesa 8y agoIt depends on your definition of palindrome. Is it 'reads the same forwards or backwards' or is it 'had the same characters in the second half as in the first, but in reverse order'? You'll find that according to most dictionaries, ()() is the palindrome here. Unless you're a robot.
- onemoresoop 8y agoor substitute the parans to a and b ()() --> abab ())( --> abba )(() --> baab We coders could get fooled by this question if we dont pay much attention