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.
I think your previous solution was more efficient, this one keesp repeatedly searching the lowerbound, the prior compared as interleaving
This is the way, I would only change a few minor things
Bello !
You're absolutely right, but the original one explicitly excluded std::merge :)
You could save some occurances of
std::list<int>::iterator::operator++
if you take it out of thefor
header, remove the assignment to the return value ofstd::list<int>::insert
, and add andelse
, but this preserves the ideas of the forked Python solution better.Yes, I hadn't thought of the complexity of
list.insert
in particular (list.pop(0)
is basically justn,list=list[0],list[1:];return n
so I don't think it's too bad, but it's possible I just don't understand how slicing works under the hood). Also, I will admit I was tempted to try and golf this answer, but that would probably just lead tolambda a,b:sorted(a+b)
as mentioned in the original, so that's pretty boring.