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.
This code is very easy to read, but I don't think it qualifies as best practice. For every character in the string, 'cnt' is checked to be less than zero. However, that check only needs to be applied when the character is ')'. For large strings, this solution will not be as efficient.
I had not considering using lambda.
With 6 seconds of time for the thread, it may be an extra challenging to try a genetic algormithm. Perhaps, impossible....
Yes, I can imagine I misinterpreted the instructions, but I don't think I did. Others code warriors here think the last test is incorrect.
I agree that the last test case is faultly. If you look at the raw data and follow the requirements, 'c' is the winner instead of 'e'.