Ad
  • Custom User Avatar

    Sorry – I had just checked that your "cheat" solution had been invalidated and that none of the other ones were.

    I've implemented your suggestion and now it should be fixed. 😅

  • Custom User Avatar

    Well, now the message is flipped:

    expected 160140.42704112644 to be close to 0 +/- 1e-7
    

    It should be user result first instead of the expected.

    My suggestion is to run the reference solution first and put the result to a variable, then match user solution with the variable like this:

    const expected = fast_sol([...islands]);
    assert.closeTo(bridge(islands), expected, 1e-7);
    
  • Custom User Avatar

    Should be fixed now 👍

  • Custom User Avatar
  • Custom User Avatar

    It's just that no one has approved it yet. Maybe there aren't enough Julia coders who can approve translations.

    It seems like some translations do take a long time to be approved. Some of the ones for this kata have been waiting for 17 months! I'd say the site probably needs to overhaul the whole way that translations are approved.

  • Custom User Avatar

    why did no one approve it?

  • Custom User Avatar

    I asked myself the same question, this is not an easy kata to rank. I would say 5-kyu or 4-kyu if the number of islands in the test was choosen so that all brute-force solutions fail, but any "textbook" implementation of the correct algorithm succeeds, regardless of language-dependant optimizations.

    If the implementation must be optimized (i.e. choosing the right data structure) in consideration of the high "density" of the bridges, then definitely 4-kyu, but it is not clear to me if that's what you required.

    A performance edition could be created (2-kyu maybe) where the number of bridges is so high that some upfront reduction is necessary (see my other comment hidden as spoiler) leveraging the 2D nature of the points representing the islands.

  • Custom 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?

  • Custom User Avatar

    Everyone's is! 😅

  • Custom User Avatar

    Finally made it, barely beating the clock! Thanks for this super kata.

    I tested a few solutions provided by others and they all seem to be in the same order of magnitude as mine. I guess for the 5000 islands case even small optimizations matter.

  • Custom User Avatar

    My solution is a roll of the dice to see if it'll finish in time, haha.

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

  • Custom User Avatar

    Tried two or three modifications of that already, but not the right ones apparently! On the upside I'm learning more about computational geometry.

  • Custom 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 😝
    
  • Custom User Avatar

    Thanks for getting back to me. I wanted to use numpy for matrix multiplication in one of my first attempts. I've tried several approaches that solve the problem but are too slow on 5000 islands, unless I use scipy. I wonder if I should replicate "that algorithm" in scipy (not saying more to avoid spoliers), but it looks a bit too challenging for a 4-kyu kata. I must be missing something obvious here 🙂

  • Loading more items...