From 2ffcef5220648fe69378ce94874405eb5559c4e8 Mon Sep 17 00:00:00 2001 From: 1227haran <68032825+1227haran@users.noreply.github.com> Date: Tue, 8 Oct 2024 00:36:50 +0530 Subject: [PATCH 1/2] Updated test cases --- data_structures/stacks/balanced_parentheses.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/data_structures/stacks/balanced_parentheses.py b/data_structures/stacks/balanced_parentheses.py index 928815bb2111..a4f532641bc7 100644 --- a/data_structures/stacks/balanced_parentheses.py +++ b/data_structures/stacks/balanced_parentheses.py @@ -9,8 +9,12 @@ def balanced_parentheses(parentheses: str) -> bool: True >>> balanced_parentheses("[(])") False - >>> balanced_parentheses("1+2*3-4") + >>> balanced_parentheses("{}") True + >>> balanced_parentheses("))((") + False + >>> balanced_parentheses("((") + False >>> balanced_parentheses("") True """ From 68be0dc3f4bdf5edf4a6066f92df398d7a27e56d Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 11 Sep 2026 08:07:06 +0200 Subject: [PATCH 2/2] Apply suggestion from @cclauss --- data_structures/stacks/balanced_parentheses.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/data_structures/stacks/balanced_parentheses.py b/data_structures/stacks/balanced_parentheses.py index a4f532641bc7..a05627bd12dd 100644 --- a/data_structures/stacks/balanced_parentheses.py +++ b/data_structures/stacks/balanced_parentheses.py @@ -9,6 +9,8 @@ def balanced_parentheses(parentheses: str) -> bool: True >>> balanced_parentheses("[(])") False + >>> balanced_parentheses("1+2*3-4") + True >>> balanced_parentheses("{}") True >>> balanced_parentheses("))((")