Cody

Problem 80. Test for balanced parentheses

Solution 2638327

Submitted on 1 Jul 2020
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   Fail
inStr = '()'; out_correct = true; assert(isequal(isBalanced(inStr),out_correct))

Error in solution: Line: 3 Column: 12 Incorrect use of '=' operator. To assign a value to a variable, use '='. To compare values for equality, use '=='.

2   Fail
inStr = ')'; out_correct = false; assert(isequal(isBalanced(inStr),out_correct))

Error in solution: Line: 3 Column: 12 Incorrect use of '=' operator. To assign a value to a variable, use '='. To compare values for equality, use '=='.

3   Fail
inStr = '(z*(a-(x+3))/(y))'; out_correct = true; assert(isequal(isBalanced(inStr),out_correct))

Error in solution: Line: 3 Column: 12 Incorrect use of '=' operator. To assign a value to a variable, use '='. To compare values for equality, use '=='.

4   Fail
inStr = ')('; out_correct = false; assert(isequal(isBalanced(inStr),out_correct))

Error in solution: Line: 3 Column: 12 Incorrect use of '=' operator. To assign a value to a variable, use '='. To compare values for equality, use '=='.

5   Fail
inStr = '(x)(x-y)'; out_correct = true; assert(isequal(isBalanced(inStr),out_correct))

Error in solution: Line: 3 Column: 12 Incorrect use of '=' operator. To assign a value to a variable, use '='. To compare values for equality, use '=='.

6   Fail
inStr = ':-)'; out_correct = false; assert(isequal(isBalanced(inStr),out_correct))

Error in solution: Line: 3 Column: 12 Incorrect use of '=' operator. To assign a value to a variable, use '='. To compare values for equality, use '=='.

7   Fail
inStr = ')()'; out_correct = false; assert(isequal(isBalanced(inStr),out_correct))

Error in solution: Line: 3 Column: 12 Incorrect use of '=' operator. To assign a value to a variable, use '='. To compare values for equality, use '=='.

8   Fail
inStr = '(()'; out_correct = false; assert(isequal(isBalanced(inStr),out_correct))

Error in solution: Line: 3 Column: 12 Incorrect use of '=' operator. To assign a value to a variable, use '='. To compare values for equality, use '=='.

Suggested Problems

More from this Author95

Community Treasure Hunt

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

Start Hunting!