Skip to content

Commit 125973e

Browse files
authored
🐜 Study: 올바른 괄호 (#67)
1 parent c6d052b commit 125973e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

올바른 괄호.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
def solution(s: str) -> bool:
2+
cur = 0
3+
for i in s:
4+
cur += (i == '(') - (i == ')')
5+
if cur < 0: return False
6+
return cur == 0

0 commit comments

Comments
 (0)