Skip to content

Commit 2ba05c2

Browse files
authored
Update find-longest-awesome-substring.py
1 parent 68725a2 commit 2ba05c2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Python/find-longest-awesome-substring.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ def longestAwesome(self, s):
77
:type s: str
88
:rtype: int
99
"""
10-
ALPHA_BET_SIZE = 10
11-
result, mask, lookup = 0, 0, [len(s)]*(2**ALPHA_BET_SIZE)
10+
ALPHABET_SIZE = 10
11+
result, mask, lookup = 0, 0, [len(s)]*(2**ALPHABET_SIZE)
1212
lookup[0] = -1
1313
for i, ch in enumerate(s):
1414
mask ^= 2**(ord(ch)-ord('0'))
1515
if lookup[mask] == len(s):
1616
lookup[mask] = i
1717
result = max(result, i - lookup[mask])
18-
for d in xrange(ALPHA_BET_SIZE):
18+
for d in xrange(ALPHABET_SIZE):
1919
result = max(result, i - lookup[mask^(2**d)])
2020
return result

0 commit comments

Comments
 (0)