From f79acdea0e002c18f2b11617e7f66ae243c7e1c2 Mon Sep 17 00:00:00 2001 From: KOUSIK ROY <83376797+KousikRoy-EC@users.noreply.github.com> Date: Fri, 2 Jun 2023 10:36:06 +0530 Subject: [PATCH] Update BalancedParenthesis.cpp the close condition was false it should check whether close element is not null and then it should start comparision --- BalancedParenthesis.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BalancedParenthesis.cpp b/BalancedParenthesis.cpp index abb79c6..03f587b 100644 --- a/BalancedParenthesis.cpp +++ b/BalancedParenthesis.cpp @@ -11,7 +11,7 @@ void solve(int open,int close ,string op,vector& v) { solve(open-1,close,op1,v); return; } - if(close>open) + if(close != 0 && close > open) { string op2 = op; op2.push_back(')');