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 comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
There is only 6 large test
Your code might not actually be
O(n log n)
. If you only manage the first 5 large tests, I really doubt it is.Post your code, maybe we can say something. If your code really is
O(n log n)
, it would have to be horribly inefficient to fail so soon, and you would probably be able to optimise it yourself ( maybe not enough, but usefully, at least ).I'd look up test driven development. Two different data structures can perform the given operation, one may take a lot longer though given the task and requirements to fulfill your test. One data structure can provide the operation instantaneously, while the other has to go through the process which may take longer. Such an example is a hash table in python(I would google this if you haven't learned this already). The mathematics portion you asked for a hint about seems to be to be an advanced understanding of math, but the exact keyword to help you look up and understand, that I do not know. This is what I can tell you with my current knowledge, it may not be the whole picture and entirely accurate, but the idea should be similiar.
it will never happen, because the second bigger vector is also of type int
im not the best at c++ but from from my understanding he makes a lambda function called add which returns whatever is made hence auto which in this case will always be void, the [&] following captures all the variables within the scope by reference this causes add to have the vector times. Then (auto text, auto time) is the parameters that add takes which in the way he uses will just become (std::string text, int time). He has if (time == 0) return; so that he will not add unneeded thing to the vector in this case a time that is 0. if the if statment is not true it will continue and push_back time which is an int that he will convert to a std::string, it will add the text which will be " day", " hour" etc. finally if time is > 1 it will add a 's' to the back of the text to make sure that it is multiple since thats what the rules imply and if time is not > 1 it will add nothing. The ? and : is a type of conditional operator, sorry for the long explanation have a great day!
Hey, did you find out what the weird bit of code does? Anyone?
:´D
Please use spoiler flag next time.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Reraised above with more detail
what about it? it goes to the
else
the C++ random tests had a bug that made them test a very small number of inputs. hopefully fixed