Cody

# Problem 1303. Is the paranthesis sequence balanced ?

Solution 2265432

Submitted on 8 May 2020 by Joshua Sonn
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
assert(isequal(balance_parens('(((()))((())))'),1))

A = 1×14 uint16 row vector 40 40 40 40 41 41 41 40 40 40 41 41 41 41 y = 1

2   Pass
assert(isequal(balance_parens('(()()())'),1))

A = 1×8 uint16 row vector 40 40 41 40 41 40 41 41 y = 1

3   Pass
assert(isequal(balance_parens(['(()()()()()()()()()()()())']),1))

A = 1×26 uint16 row vector 40 40 41 40 41 40 41 40 41 40 41 40 41 40 41 40 41 40 41 40 41 40 41 40 41 41 y = 1

4   Pass
assert(isequal(balance_parens('(()()()))))'),0))

A = 1×11 uint16 row vector 40 40 41 40 41 40 41 41 41 41 41 y = 1 y = 0

5   Pass
assert(isequal(balance_parens('(()()(((((((((((()))))'),0))

A = 1×22 uint16 row vector 40 40 41 40 41 40 40 40 40 40 40 40 40 40 40 40 40 41 41 41 41 41 y = 1 y = 0

6   Pass
assert(isequal(balance_parens('))()())'),0))

A = 1×7 uint16 row vector 41 41 40 41 40 41 41 y = 1 y = 0

7   Pass
assert(isequal(balance_parens('(()()()()((()))()()()(((()))))'),1))

A = 1×30 uint16 row vector 40 40 41 40 41 40 41 40 41 40 40 40 41 41 41 40 41 40 41 40 41 40 40 40 40 41 41 41 41 41 y = 1

8   Pass
assert(isequal(balance_parens('((((()))))'),1))

A = 1×10 uint16 row vector 40 40 40 40 40 41 41 41 41 41 y = 1