Simple 5 line Python sol | sliding window


#1

class Solution:
# @param A : string
# @return a strings
def longestPalindrome(self, A):
for length in reversed(range(len(A)+1)):
for start in range(len(A)-length):
window = A[start:start+length+1]
if window==window[::-1]:
return window