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.
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 :)
this is legit dope
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.
no need for
? 1 : 0
in the for-loop, no need to check whether
wariors
actually containsc
;wariors[c] == 0
ifc
is not inwariors
(actually the first time it is added with default value0
)very clever
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?