Ad
  • Custom User Avatar

    This is actually the reason I created this kata in the first place. After solving the 'insane' version and looking at the official solution, I realized it allowed solutions based on algorithms with far from optimal time complexity. So I created this one (the JS version only, the Python translation is not mine), so that people figuring out the actual best way to compute this could earn more points.
    (So, long story short, the 'free' score increase is actually the 'insane' version, not this one ;-) .)

  • Custom User Avatar

    Hi guys, I'm the original author of this kata.
    Sorry for the very long delay, I haven't been on CodeWars for almost a year. I recently got a few notifications from the site, and I thought it might be worth clarifying a few things here.

    First, note that I only wrote the initial JS code, not the Python version, which I haven't really looked at, so I'll only speak about the JS version.

    Now, let's talk about speed. Most of the time in this kata is spent generating the samples. It takes a LOT longer to generate the super long strings than to process them. So this is perfectly normal that submitting an empty function still takes several seconds to run.
    It is also true that the execution times varies significantly depending on the server load, and that you shouldn't expect 99% success rate.
    That being said, when I created this kata about one year ago, it typically took around 6 to 8 seconds to run.
    I've just run a few tests and it seems that it is now closer to 9-11 seconds, with great variability (I tried about ten times and got two timeouts, one run under 8 seconds, two between 8 and 9, and the rest between 9 and 11.9 s)...
    This is not great (I actually expected speed to increase over time, not decrease), but it still leaves room to complete the kata with a decent success rate (say at least 50%): if you're sure your solution should but it still hits the timeout, just submit it once again and it should be ok.

    I agree that it's not ideal, especially for people who are limited to using CodeWars at rush hour, but I'm afraid that, by removing some tests or making them less random, it will make it possible to complete the kata without getting the right algorithm and cutting down the complexity, thus defeating the kata's purpose. It was precisely written as a tougher version of Bubbler's "Insane Coloured Triangles", which is rather forgiving in that aspect, so the fact that it runs on the edge of the timeout is kind of a necessary pain.

    I'm sorry if this is not very helpful, I wish there were a differentiated, adjustable timeout system that would allow to time the input genration and the solution test separately, thus removing that server load dependency, but unfortunately this is not the way the system works.
    In the meantime, keep in mind that the solution should litterally be able to crunch gigabyte-sized inputs in fractions of a second. And if the sample input generation takes too long, just hit the 'retry' button until it passes :-/

    Cheers.

  • Custom User Avatar

    Hi. I'm afraid it will take longer than expected, because my computer died :(
    Sorry for the delay...

  • Custom User Avatar

    Thanks a lot for the translation!!
    I'm not sure I'll have time to check this out during the weekend, but I'll have a look at this next week.

  • Custom User Avatar

    Quick note about rank assessment.
    I believe this should be a 3kyu rather than a 2kyu, as it's a lot easier than other 2kyu I've seen. The problem is that it's based on Bubbler's Insane version, which is already ranked 2kyu, and this one is "harder", in the sense that any solution that beats it will also be valid for the other one.
    So I thought it wouldn't make sense to give it a lower rank, and chose 2kyu, even though I still think it's kind of overranking.

  • Custom User Avatar

    It may have ;-)
    But it looks like you got the last word. Well done!

  • Custom User Avatar

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

  • Custom User Avatar
  • Custom User Avatar

    Super nice kata! If you liked it, you may also like this new version I just published called Ludicrous Coloured Triangles. It's basically the same as this one, but even more insane and requiring extra optimization (although this doesn't necessarily make it more difficult to solve).
    Sorry for using this space for "advertising"... but I hope people interested in this kata will find the new one interesting too.

    Note to the author or moderators: I'm not familiar at all with kata creation as this is my first one, and I couldn't find any specific instructions on making "step-up" or "spin-off" kata, so I just created a new one from scratch and put a backlink to this one in the description. If this is not the right way to do it please let me know and I'll update it.

  • Custom User Avatar

    Very interesting!

    The way it's presented, i.e. going through all the details of partitions and pretending this is an optimization challenge while it's actually more of a maths problem, is quite machiavellian... I love it!
    Because this is what real-world problems look like. More often than not, the way you encounter them is deceptive, and they don't come with green arrows and flashing signs pointing you to the right approach.

    Thanks a lot for this fun brain twister :)

  • Custom User Avatar

    Shouldn't this be a 3kyu? It's significantly harder and longer than most 4kyus I've seen...
    That being said, I don't know how the kata ranking works (and haven't authored one yet), and the system may have changed since this one was published.
    Does anybody know if a kata's rank can evolve over time, or if it is fixed once and for all?

    Anyway, it was a very fun one! Thanks a lot.

  • Custom User Avatar

    Hi all,
    I've read somewhere on that topic page that CodeWars uses Gravatar for profile pics, but I cant't get this to work, so I'm under the impression this information is somehow wrong (or outdated).
    Does anyone know if there is a way to change the profile picture other than linking a GitHub account?

    Thanks :)

  • Custom User Avatar

    It's now available in JS and Java.

  • Custom User Avatar

    It's just been done :)

  • Custom User Avatar
  • Loading more items...