Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Hi, I have a question about finding the length of the longest substring in the given string s that is the same in reverse. As an example, if the input was “I like racecars that go fast”, the substring (racecar) length would be 7. My code is follow and I don't know where is wrong, How do I do this?
def longest_palindrome (s):
for i in range(len(s)):
for j in range(len(s),i,-1):
n = s[i:j]
if n == n[::-1]:
return len(n)