Cody

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.

e.g.

>> balance('(()()())')
   1
>> balance('(()()())(') 
   0
>> balance('(())))()())')
   0
>> balance('(((()))((())))')
   1

Hint: consider using a stack. Review your basic data structures for ideas.

Solution Stats

53.63% Correct | 46.37% Incorrect
Last Solution submitted on Oct 05, 2019

Problem Comments

Problem Recent Solvers73

Suggested Problems

More from this Author12