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.
Thanks for this kata.
I think the test has a serious deficiency: it does not check if the solution contains the smallest possible numbers, although this condition is stated in the problem description. Please modify the test or the description.
This comment is hidden because it contains spoiler information about the solution
The
check_list
test function always returnsTrue
if one of the arrays is empty.There seems to be an issue with the test case in Python, when I try and just return the passed variable in the function to see what datatype needs returned, it says there is something wrong with the test case, I might just be stupid but I don't think that is supposed to happen.
Hello! Try writing solutions for smaller arrays on paper (Note that there are many solutions). Some of them will help you find the pattern
I can't even solve this with pen and paper. Am I stupid or is this a very difficult one?
Any hints to get started?
Approved
I forked the kata with a more efficient solution verification method. What with all the talk about performance in the discourse below, I figured a good way to start was to eliminate the O(n²) operation that had to be performed on every test.
Maybe someone can take a look and see whether I missed anything.
I would specify in the description the intended time complexity, and also add a tag:
performance
I hope users will revote knowing these performance constraints
did it just before I went to sleep, not thinking too much...
This is a very naughty solution ;-) Are you sure you're writing in Python?
Perhaps you can just use my solution and demand an O(n) solution.
Of course.
You can use the one I forked, more neat.
It is, thanks!
Loading more items...