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.
Approved.
The updates to the description needs fixing, see conditional-rendering. I think the part "50 performance tests, with arrays of size
500 000
." is the only thing that needs to be conditioned on language, and it should preferably not be in a language code block.It is mostly looking good to me, but I have two minor concerns.
The entire vector should probably not be printed on wrong output when the vector is very long. Intead it could print the first few entries and ... or something like that.
This is using the same size for the performace tests as the python version even though C++ runs much faster. A naive O(n^2) solution seem to time out, but maybe there some slightly better algorithms that would pass that here that would time out in the python version. I think the best would be to increase the input size somewhat, (maybe to 1e6?). The description would have to be changed as well with language specific blocks I guess.
I added some tests with different ratios of odd/even, but I don't actually think there is a way to exploit that it is about 50-50, so it is ok that you skipped this.
Thanks for a great kata!
This comment is hidden because it contains spoiler information about the solution
C++ translation
C++ Translation
Sure, I'll put it on my todo list :)
Somehow I thought that random.choices in python was without repetitions.
Anyway, here is a fork with updated tests (including the
[4, 4, 4, 4, 4]
test): https://www.codewars.com/kumite/6364ffd71663bc0069bf98b7?sel=636636d1c94f160030e14290There are no repetitions of numbers in the random tests in the C++ version as well. Do you want me to change this?
C++ translation
Just some hundred milliseconds or so.
It is possible to pass with linear time complexity solutions in the C and C++ versions, but in the python and javascript version such solutions time out.
It should be fixed now.
Thanks for pointing this out, I will fix this
Loading more items...