Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Recursion solution in Clear category for The Longest Palindromic by lexin13
def longest_palindromic(text):
if ''.join(list(text)[::-1]) == text:
return text
r1 = longest_palindromic(text[:-1])
r2 = longest_palindromic(text[1:])
return max(r1, r2, key=len)
March 20, 2016
Comments: