Cody

# Problem 1303. Is the paranthesis sequence balanced ?

Solution 338015

Submitted on 23 Oct 2013 by Michael Cappello
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

This solution is outdated. To rescore this solution, sign in.

### Test Suite

Test Status Code Input and Output
1   Pass
%% assert(isequal(balance('(((()))((())))'),1)) assert(isequal(balance('(()()())'),1)) assert(isequal(balance(['(()()()()()()()()()()()())']),1)) assert(isequal(balance('(()()()))))'),0)) assert(isequal(balance('(()()(((((((((((()))))'),0)) assert(isequal(balance('))()())'),0)) assert(isequal(balance('(()()()()((()))()()()(((()))))'),1)) assert(isequal(balance('((((()))))'),1))

y = 0 na = 14 x = ((())(())) nb = 10 na = 10 x = (()()) nb = 6 na = 6 x = () nb = 2 na = 2 x = '' nb = 0 y = 1 y = 0 na = 8 x = () nb = 2 na = 2 x = '' nb = 0 y = 1 y = 0 na = 26 x = () nb = 2 na = 2 x = '' nb = 0 y = 1 y = 0 na = 11 x = ()))) nb = 5 na = 5 x = ))) nb = 3 na = 3 x = ))) nb = 3 y = 0 na = 22 x = (((((((((((()))) nb = 16 na = 16 x = ((((((((((())) nb = 14 na = 14 x = (((((((((()) nb = 12 na = 12 x = ((((((((() nb = 10 na = 10 x = (((((((( nb = 8 na = 8 x = (((((((( nb = 8 y = 0 na = 7 x = ))) nb = 3 na = 3 x = ))) nb = 3 y = 0 na = 30 x = ((())((()))) nb = 12 na = 12 x = (()(())) nb = 8 na = 8 x = (()) nb = 4 na = 4 x = () nb = 2 na = 2 x = '' nb = 0 y = 1 y = 0 na = 10 x = (((()))) nb = 8 na = 8 x = ((())) nb = 6 na = 6 x = (()) nb = 4 na = 4 x = () nb = 2 na = 2 x = '' nb = 0 y = 1