can be solved without 'regexp'
A slightly more robust test might include a balanced equation starting with something other than an opening bracket.
Test 3 might be
inStr = '3*(z*(a-(x+3))/(y))';
Wrong solution.
it doesn't work in some cases not included in test suite. for example:
inStr = '(z*(a-(x+3))/(y)*z)';
Nice solution
Seems to fail for inStr='(' , '((', etc.
I admit this is cheating, but I think it also stresses the need for more tests in the suite. Also, not all the cases should necessarily be visible, so you can't adapt a solution like this.
This solution fails for the input ')()', i.e. it returns true when it should return false.
This solution fails for the input '(()', i.e. it returns true when it should return false.
This solution fails for the input '(()', i.e. it returns true when it should return false.
This entry is incorrect. It fails the simple case of:
isBalanced('(')
253 Solvers
Back to basics 4 - Search Path
322 Solvers
Rotate and display numbered tile
239 Solvers
Create matrix of replicated elements
322 Solvers
359 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!