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.
While this solution is intuitive, in practice it is costly!
Keep in mind that strings are contiguous containers and its elements must always be laid out in memory one after another.
Hence, every time you erase a character, the program will have to "move" (copy) elements that come after it to fill the gap.
In a worst case scenario where all characters are same (i.e. "aaaaaaaaaaaaaaaaa") it will have to perform many iterations and copies,
with a significant impact on code performance.
This comment is hidden because it contains spoiler information about the solution