Check for Balanced Parentheses using Stack?
If the current character is a starting bracket ('(' or '{' or '[') then push it to stack. If the current character is a closing bracket (')' or '}' or ']') then pop from stack and if the popped character is the matching starting bracket then fine else brackets are not balanced.
| Is This Answer Correct ? | 0 Yes | 0 No |
What is c++ and its uses?
What are the different types of variables in C++?
Can we define a constructor as virtual in c++?
write a program to add two numbers without using an arithmetic operator.
What is the use of vtable?
What are pointer-to-members? Explain.
What is the Standard Template Library?
What is the difference between const and constexpr?
What is the handle class?
What is a constructor initializer list and when we use constructor initializer list?
What are move semantics?
What is the protected keyword used for?