Skip to content

Commit 4d5a1fe

Browse files
authored
Update maximum-product-of-the-length-of-two-palindromic-subsequences.py
1 parent dcad3ee commit 4d5a1fe

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def palindromic_subsequence_length(s, mask):
3232
# submask enumeration:
3333
# => sum(nCr(n, k) * 2^k for k in xrange(n+1)) = (1 + 2)^n = 3^n
3434
# => Time: O(3^n), see https://cp-algorithms.com/algebra/all-submasks.html
35-
submask = inverse_mask = (len(dp)-1) ^ mask
35+
submask = inverse_mask = (len(dp)-1)^mask
3636
while submask:
3737
result = max(result, dp[mask]*dp[submask])
3838
submask = (submask-1)&inverse_mask

0 commit comments

Comments
 (0)