Skip to content

Commit ed3d1ee

Browse files
committed
🐜 Study: 올바른 괄호
1 parent 40380e1 commit ed3d1ee

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

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