Skip to content

Commit bd4270f

Browse files
committed
Improve memory allocation
1 parent 2d6f0ec commit bd4270f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

strings/is_substring_palindrome.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ def preprocess(s):
1111
global text
1212
global dp
1313
text = s
14-
dp = [[False for i in range(MAX_LEN)] for i in range(MAX_LEN)]
1514
n = len(s)
15+
dp = [[False for i in range(n)] for i in range(n)]
1616

1717
for i in range(n):
1818
dp[i][i] = True

0 commit comments

Comments
 (0)