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.
Your condition is wrong. Because you cannot rely on the counts of character '(' or ')'.
Let me give you an example:
")()(" your solution will return true for this input string, however its not a valid parentheses.
The right parentheses not only the counts of '(' or ')' should be equal, but the order also need to be matched.
why is using substring considered better that charAt?
but i think my solution for the
Kata
may be easier to understand (from JavaScript programmer's perspective):)
The kata's description says "Utilize the comprehension syntax in the following exercise"
2333333333333333333....