Skip to content

Commit 6b15a76

Browse files
committed
Update 0020-valid-parentheses.py
avoid using 'map' as variable name to avoid overriding a built-in Signed-off-by: Chiao Yang <[email protected]>
1 parent 5ebb02d commit 6b15a76

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: python/0020-valid-parentheses.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
class Solution:
22
def isValid(self, s: str) -> bool:
3-
Map = {")": "(", "]": "[", "}": "{"}
3+
bracketMap = {")": "(", "]": "[", "}": "{"}
44
stack = []
55

66
for c in s:
7-
if c not in Map:
7+
if c not in bracketMap:
88
stack.append(c)
99
continue
10-
if not stack or stack[-1] != Map[c]:
10+
if not stack or stack[-1] != bracketMap[c]:
1111
return False
1212
stack.pop()
1313

0 commit comments

Comments
 (0)