Python Code 100% work


  • 0
    W

    class an():
    def find(self,x):
    listx = list(x)
    new =[]
    for i in range(1,len(listx)):
    j = 1
    while (i-j)!=0 and (i+j) != len(listx):
    if listx[i-j]==listx[i+j]:
    new.append(listx[i-j:i+j+1])
    j = j+1
    else:
    break
    l = 1
    po = 0
    for a,b in enumerate(new):
    temp = len(b)
    if temp > l:
    l =temp
    po = a
    if l>1:
    print(''.join(new[po]))
    else:
    print("No Palindromic")


  • 0
    D

    Format is wrong, 100% won't work.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.