Ad
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    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].

  • Custom User Avatar

    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)

  • Default User Avatar

    There is room to cast it to integers.

  • Default User Avatar

    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?

  • Default User Avatar

    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).

  • Default User Avatar

    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)...

    
    I used a modification of the algorithm that rhymes with Kim's algorithm. Other people did it in cleverer ways though, so use your imagination 😝
    
  • Default User Avatar

    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.

  • Custom User Avatar

    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 "->".

  • Custom User Avatar

    I'm happy you liked it!

  • Custom User Avatar

    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.

  • Custom User Avatar

    You can raise an issue on github:codewars/content-issues. Spouting your opinion here is not useful.

  • Custom User Avatar

    Old kata cannot be re-ranked, closing!

  • Custom User Avatar

    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

  • Default User Avatar

    Hey @alexc19 - thanks for the kind words, glad you enjoyed! For the rating, votes clustered around 6 with a few 7s and a few 5s.

    I think it's the nature of code golf/puzzle katas that they are much harder to rate with sometimes huge variance. I personally think I will stop making code golf katas after this one, because of that reason (well unless I have a really good one ;) )

  • Loading more items...