Skip to content

Commit 80f9a65

Browse files
authored
Update maximum-product-of-the-length-of-two-palindromic-substrings.py
1 parent 1bb93be commit 80f9a65

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

Python/maximum-product-of-the-length-of-two-palindromic-substrings.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,7 @@ def fin_max_len(s):
8787
dp[r] = r-l+1
8888
for i in reversed(xrange(len(s)-1)):
8989
dp[i] = max(dp[i], dp[i+1]-2)
90-
dp.pop()
91-
return list(accumulate(dp, max))
90+
return list(accumulate(dp, max, 0))
9291

9392
l1, l2 = fin_max_len(s), fin_max_len(s[::-1])[::-1]
9493
return max(x*y for x, y in itertools.izip(l1, l2))

0 commit comments

Comments
 (0)