Skip to content

Commit 18b26b0

Browse files
ing-eokingbugs-bot
authored andcommitted
🐜 Study: 올바른 괄호 (#67)
1 parent c6d052b commit 18b26b0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

ing-eoking/올바른 괄호.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)