4 ms·
I think that '()))((' will be judged balanced by the above code.
by jejones3141 8y ago
I think that '()))((' will be judged balanced by the above code.
- db48x 8y agoNo, he checks each time through the loop to see if the counter ever goes below zero; if it does, then the string is unbalanced.
- kerkeslager 8y agoWhy don't you write a unit test and see? :)