Problem 1303. Is the paranthesis sequence balanced ?

Quantum mechanics and computer science are interested in bra-kets. Today however you, the player, will have to write a function to find if the given parenthesis expression is balanced.
>> balance('(()()())')
>> balance('(()()())(')
>> balance('(())))()())')
>> balance('(((()))((())))')
Hint: consider using a stack. Review your basic data structures for ideas.

Solution Stats

48.28% Correct | 51.72% Incorrect
Last Solution submitted on Feb 19, 2024

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers157

Suggested Problems

More from this Author10

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!