Balanced parenthesis problem stack


in this code only the sample testcase passes.
kindly comment out the error

for test case like
()) the answer should be No

1. Each time you encounter an open bracket simply push it into stack.
2. If you got any closed bracket.
2.1 If the stack is empty return false.
2.2 Check if the closed bracket matches the peek element of stack.
    2.3.1 If yes pop the element and continue.   
    2.3.2  else return false.
3. At the end return true if stack is empty.

see this: https://ide.codingblocks.com/s/431361