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.
Is modifying the input really best practice?
1
5 yo , but anyway .
Vectors have a reserve member function .
So , even little ineficient can be removed ... with the right situation for reserve of course :)
It's definitely a little more inefficient, but I don't think that the inefficiency is a huge deal here. However, that is something to keep in mind.
isn't this very inefficient? I mean, using push_back every iteration leads to multiple reallocation, instead wouldn't it be better to initialize output vector with known size n?
have a look at c++ algorithms. http://en.cppreference.com/w/cpp/algorithm
wrong
Assert::That(stray({1, 2, 2}), Equals(1));
Expected: equal to 1
Actual: 2
wrong