« first day (2779 days earlier)      last day (574 days later) » 

12:00 AM
 
 
14 hours later…
Rnj
1:31 PM
guys let me ask stupid question. Below code is giving me error "local variable 'palLen' referenced before assignment".

```
def longestPalindrome(s: str) -> str:
n = len(s)
palLen = 0
longestPalR = -1
longestPalL = -1

def checkPal(l,r, curPalLen):

while -1<l and r<n and s[l] == s[r]:
curPalLen += 2

if curPalLen > palLen:
palLen = curPalLen
longestPalR = r
longestPalL = l

l-=1
r+=1

for i in range (0, n):
checkPal(i,i, 1)
checkPal(i,i+1, 0)

return s[longestPalR, longestPalL+1]

longestPalindrome("babad")
However this works perfectly:

```
def longestPalindrome2():
palLen = 1

def checkPal2():
print(palLen)

checkPal2()

longestPalindrome2()
```
 
 
2 hours later…
3:29 PM
Zoe stands with Ukraine has unfrozen this room.
 
2 messages moved from Python
 

« first day (2779 days earlier)      last day (574 days later) »