Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Why is this faster? Are lots of cases in an if statement slow? Would a switch be faster?
If n equals 0, then there are an equal amount of opening and closing parentheses. Otherwise there are more of on or the other and the parens wouldn't be valid. It checks if the order is right with the if statement in the loop (n < 0)