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 requires O(n) extra space. This can be done using O(1) extra space.
To me, this is a good solution, uses available STL functions and is quite readable.
However, it could be improved by not having so much going on on the return-line. This is not a competition to write the fewest lines.
If you want to be the envy of your coworkers in the future, write readable code.
Also, this might be a consequence of the platform, but you should never write code in your class declaration. Always, ALWAYS put the code in the implementation.