Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Can you solve it? The Greplin programming challenge. Parent comment
Try this:
for i in range(len(str)): for j in range(i, len(str)): if str[i:j] == str[i:j][::-1]: #...
There are no comments on this comment yet.
Try this:
Choose the start and end indices. Then take a slice to see if it's a palindrome. Nice and speedy! :)