Ad
  • Default User Avatar

    With the other one no memoization is needed. But it's fine I will remove the kata as promised, I was just interested to see how others would solve this.

    edit: Looking at monadius's solution I now realize the program is not reset inbetween test cases, all this time I assumed this was the case. As it stands now it is in practice a duplicate. I have unpublished the kata

  • Default User Avatar

    I checked, your solution takes 8 seconds to calculate 1 case of 5e6, it will time out on the 70 test cases in this kata. I would argue the point of these two kata's is different, but we can disagree on that. I don't think a translation should be significantly harder than the original, that would also undermine the spirit of were_cat's kata. There are a lot of examples of kata that have both an easy and hard version on here, mostly being different in their input range.

    Having said that, if someone ends up solving this kata with a similar trivial approach, I will agree and withdraw this kata immediately

  • Default User Avatar

    Bedankt, added input range to description

  • Default User Avatar

    Thank you for your reply. I checked the kata you mention before publishing mine. While they too claim performance, the input range of the random tests are only up to 2x10^5 for just a couple of cases. As advised by the author these "large" cases can even be avoided by submitting repeatedly to get a test set without these numbers.

    In this kata however up to 5x10^6 is checked consistently. The bruteforce algorithms that work for that kata and the mentioned optimizations in the description will not suffice.

    I have found it rare to see input ranges mentioned in kata explanations, but I will add them now to the description for added clarity. I must say I do like kata's that are clear on this better.