Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximSmolskiy committed Apr 1, 2024
1 parent 3e30751 commit a0f8b6f
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions data_structures/stacks/balanced_parentheses.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@ def balanced_parentheses(parentheses: str) -> bool:
for bracket in parentheses:
if bracket in bracket_pairs:
stack.push(bracket)
elif (
bracket in (")", "]", "}")
and stack.is_empty()
or bracket_pairs[stack.pop()] != bracket
):
elif bracket in (")", "]", "}") and (stack.is_empty() or bracket_pairs[stack.pop()] != bracket):
return False
return stack.is_empty()

Expand Down

0 comments on commit a0f8b6f

Please sign in to comment.