Not cheating, just clever... ;-)
Note: a 50th Mersenne Prime was just discovered -- https://www.mersenne.org/primes/press/M77232917.html
Thank you for your feedback. I myself estimated it as 6 kyu when I created it. ;)
I don't think this issue is resolved.
In : import numpy
In : help([redacted_spoiler])
The ordering of the elements in the two partitions is undefined.
This means you should not rely on this particular function to produce reliable ordering, even if the algorithm in use in the current version of Python+Numpy that Codewars uses produces predictable results in practice.
I personally think this is a more interesting problem without specifying the use of numpy. If you want it to be about the numpy function specifically, then you should check for use of the function in submitted solutions.
In any case, you should either specify a particular order and check for that order or in your checks, you should not require a specific order. A particular order has not been specified by referencing the numpy function because the function documentation itself says no particular order is defined.
I had been wondering, should I be breaking randomness here or digging around in global variables here -- I wouldn't have expected either one to get ranked as 7kyu, except that I guess that at this point enough other katas have involved one or the other that people aren't finding it more of a big deal any more.
This comment is hidden because it contains spoiler information about the solution
Actually, I thought about sorting for some reason, it's not. But all of that is still valid: the algorithm is unstable and there may be more than 1 algorithm in future versions of Numpy.
There're quicksort, mergesort and heapsort in Numpy. Only mergesort is stable and that's not what is expected. There are 2 unstable sort and the order is not defined. So a concrete algorithm and a version of Numpy should be specified, which would still not be good because you can't guarantee that that version would be available and theoretically quicksort can use random pivots.
The sort order is determined by the Numpy function that is used to solve this kata.
This is not a difficult kata.
Whether Numpy should be used or not, it should be clear what is expected. So what order is expected?
Thanks for that valid comment. I have updated the kata description to include more details.
This kata focuses on the Numpy python package and you can read up on the Numpy sorting functions here: https://docs.scipy.org/doc/numpy-1.13.0/reference/routines.sort.html#sorting
You should use Numpy to solve this kata.
It is not the logic that I expected and I have no idea why it passes the tests yet.
Interesting solution. :)
With an example test case like this (and the others)
reorder([6, 5, 8, 1, 7, 2, 9, 3, 4],2) == [1, 2, 3, 6, 7, 5, 9, 8, 4]
why is the reordering [1, 2, 3, 6, 7, 5, 9, 8, 4] instead of [1, 2, 6, 5, 8, 7, 9, 3, 4]?
[1, 2, 3, 6, 7, 5, 9, 8, 4]
[1, 2, 6, 5, 8, 7, 9, 3, 4]
I am proud to finish this Kata! It took 5 hours of my time and some cup of coffee, but I made it, I wish I had more experince so
I could do a simple code.
I feel the same! my solution is big! I don't know how i pass all the tests!