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.
You can't refactor it if you can't solve it badly.
This comment is hidden because it contains spoiler information about the solution
You will get the same final answer regardless of which i and j you choose for each iteration, so long as
X[i] > X[j]
.and you neither have to sort the arrays but fill the appropriate count of values instead. But I guess than it becomes more verbous (not an expert on Python's syntactic sugar)
There is room to cast it to integers.
Congrats! And thank you for the kind words.
Yes, I picked the maximum number of islands carefully π
Out of interest, what kyu rating would you give it?
Hmm... maybe another hint then, or at least something to try: some people made use of heap queues, which I've found seem to speed up even non-optimal algorithms dramatically (especially ones where you need to repeatedly find the minimum item).
I wouldn't say it's that obvious. Personally, I think this should be 3 kyu β it was approved when it was easier, before I could increase the number of islands as much as I fully intended. Now it's stuck at 4 kyu π€¦. Just be thankful you're not doing it in JS β that version has 15,000 islands π ! But anyway, you're 1 kyu, so it shouldn't be too much of a problem.
But if you're really stuck, here's a hint (I'm pretty sure you already know it though)...
Thanks for the feedback. I've put in the description that the coordinates are real numbers, and I've added "performance" to the tags.
The module forbidder was written by someone else, so I might have to get his input on the numpy thing if I can't figure it out myself. It's probably because numpy imports sys, but I'm not sure how essential it is to forbid sys. It might be that either sys gets allowed (and a way to "cheat" gets opened up) or I'll have to add numpy to the list of forbidden modules. What did you want to use it for, out of interest? None of the (now invalidated) solutions that I can see used numpy before the module forbidder was implemented, except to prepare arrays for feeding into scipy.
EDIT: It's fixed now β you should be able to import numpy.
Agreed! I also think the order of the arrows should be changed. Saying "X1 -> ... " means, to me, "with the input X1 you get the following". But the author actually means "X1 is dervied from...".
This should be changed to match the common mathematical usage of "->".
I'm happy you liked it!
The rank breakdown actually gives 7 kyu by a large majority, but the shown average was computed with the old rules (meaning, flooring the result instead of rounding).
Considering the number of completions, the rank won't be changed.
You can raise an issue on github:codewars/content-issues. Spouting your opinion here is not useful.
Old kata cannot be re-ranked, closing!
Excellent points -- I would reinstate the list and the "if q" guard on the append. Particularly after finding this reaffirmation: https://stackoverflow.com/a/2414916
Loading more items...