News for hackers. Stuff that matters.
Re:A Brutal Look at Balanced Parentheses, Computing Machines... by jejones3141 on Friday February 22, 2019 @07:16PM (#19230469)
I think that '()))((' will be judged balanced by the above code.
Re:A Brutal Look at Balanced Parentheses, Computing Machines... by db48x on Saturday February 23, 2019 @12:34AM (#19231863)
No, he checks each time through the loop to see if the counter ever goes below zero; if it does, then the string is unbalanced.
Re:A Brutal Look at Balanced Parentheses, Computing Machines... by kerkeslager on Saturday February 23, 2019 @08:39AM (#19233273)
Why don't you write a unit test and see? :)