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.
you can just have a single str variable, equal it to the input braces and then equal str to str.replace() for each brace
prev is only here to ensure the while loop will stop. The moment there're no more valid brace couples, both prev and str will have same length, hence stopping loop.
but what is the need for prev here?
This comment is hidden because it contains spoiler information about the solution