Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitef387b1

Browse files
authored
Merge pull requestneetcode-gh#4056 from ChiaoY/python-0020
Update 0020-valid-parentheses.py
2 parentsd2bcd42 +c92da38 commitef387b1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎python/0020-valid-parentheses.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
classSolution:
22
defisValid(self,s:str)->bool:
3-
Map= {")":"(","]":"[","}":"{"}
3+
bracketMap= {")":"(","]":"[","}":"{"}
44
stack= []
55

66
forcins:
7-
ifcnotinMap:
7+
ifcnotinbracketMap:
88
stack.append(c)
99
continue
10-
ifnotstackorstack[-1]!=Map[c]:
10+
ifnotstackorstack[-1]!=bracketMap[c]:
1111
returnFalse
1212
stack.pop()
1313

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp