Ad
  • Custom User Avatar

    Ok, thanks for clarification

  • Custom User Avatar

    This Kata uses a very ridiculous optimization technique. Let's just say, the Kata really wants you to optimize the fact that only up to exactly a million elements will tested. It's overkill if you ask. Your algorithm is likely correct, but try to aggressively optimize everything other than your algorithm too.

  • Custom User Avatar

    I think there is a problem with this kata. I prepared a solution and tested it on my local machine + js sandbox. My solution returns the variable "result" which is integer. When I make an attemp - it works slowly and as a result i caught timeout error. My solution is correct(there is no proble with it), it is executed vast everywhere except codewars. Moreover, I get the right answer during my code execution. The problem is in the output. If I convert my answer to string(for instance) - I get an error that MY ANSWER IS WRONG BECAUSE OF THE TYPE MISSMATH, but I see that the result of my calculation is right and mathces the final answer of this kata(the same situation happens when I convert the "result" variable to object). Could you please take a look at this point? If it is needed, I can post my solution in this chat

  • Custom User Avatar
  • Custom User Avatar
  • Custom User Avatar

    Ruby translation kumited -- please check and approve!

  • Custom User Avatar
  • Custom User Avatar

    Python translation. Please, review and approve.

  • Custom User Avatar
  • Custom User Avatar

    The Example is wrong.

    rec(0) == 0
    rec(1) == 0
    rec(2) == 1
    rec(2) == 4 //should be rec(3)
    rec(2) == 10 //should be rec(4)
    rec(5) == 12

  • Custom User Avatar

    I think you've overdone it

    Idk really. IMO, the only hard part is understanding how to properly memoize the results, and even then it is very easy to implement it.


    Zed's is a remnant of simpler times.

    For some reason CW invalidated all solutions except for his one O_o

  • Custom User Avatar

    I think you've overdone it. Notice that nobody is interested anymore - yours is the only solution. ( Zed's is a remnant of simpler times. )

    Then again, I've never been interested in ridiculous performance. And / or I just suck.

  • Custom User Avatar

    Reference solution takes mere 3.5 - 4 seconds, so your code can be at most twice as slow to pass the tests ;)

    Generating the sequence is easy, but you should think well about how to deal with the other parts of the tasks.

  • Custom User Avatar

    Seems a bit hard for me. I tried solving it with memoization, but my code times out on random tests. Though maybe I just suck. ;(

  • Custom User Avatar

    I believe that line was removed because the author wanted the users to optimize their solutions but in the end it was a "fake requirement". With proper tests and a good reference solutions this could be enforced - which I did. At the same time, the tests can still be tweaked to make it easier leaving the difficulty somewhere in a "yellow range".

    Moreover, the author is inactive, so we can't ask him whether this was the right choice. Considering how low-honor users drift away never coming back, most probably there won't be a chance in the future as well, so it's up to community what to do with the kata (and AFAIK making a kata more challenging doesn't meak making it worse).

  • Loading more items...