Ad
  • Custom User Avatar

    This problem is way more strictly mathematical in fact and requires some generalization based on research indeed.

  • Default User Avatar
  • Default User Avatar

    I liked the kata but I agree, this part about always having a direction even when no keys are pressed at all and therefore there is no movement is weird. An invalid/uninitialized direction like e.g. -1 or 0 would have made the API clearer. The default UP direction does not make much sense either.

  • Custom User Avatar

    I rarely say bad things about a kata, but this one was confusing in Java.

    My main problem was that my direction always should be something of 2/4/6/8, it is constantly tested, just as my initial direction as 8. But at the same time if the player presses 8, I cannot start moving into that direction, even though basically I was facing that direction already. I let that go, because initial state and stuff.

    But then random tests started failing, because apparently if every key is released, I should "lose" my direction (well, obviously not actually lose it, because the tests will still test it, there was a rule that I should not change direction if nothing is pressed). But then once again, I am facing a direction, and if that key is pressed, i should not start moving, but should face into that direction even more. I mean I could figure it out, but I think the rules of this game are a bit unclear.

    Even if you do not accept something like direction -1 for "rest state" (just from the top of my head), it could be clarified in the rules, that even if you technically face a direction at the beginning of the game and after all keys were relesed, you should never start moving instantly. Technically rule #2 implies something like you should never start moving before the second iteration of a key being pressed, but the first rule implies that you should not start moving because you should first change your direction.

    Still gave it a Somewhat though, the idea is really cool.

  • Custom User Avatar

    Not gonna lie, I postponed solving this one for a long time, because I always felt this is gonna be so hard and complicated, my code will time out etc. Finally started to actually code it, it was fun and it took me no more than 3 hours to pass all tests, so yeah... I was wrong.
    Do not let the description or the unusual problem discourage you, it is a really cool one! Do not be like me, give it a try!

  • Default User Avatar
  • Custom User Avatar

    What's mean for Python?
    Time: 10865ms Passed: 10 Failed: 0 Exit Code: 137 and not about buffer or stderr or etc.
    But kata is not marked as solved.
    What should I do?

  • Custom User Avatar
  • Custom User Avatar

    Thank you for your hard work!

  • Custom User Avatar
  • Default User Avatar

    I just did, and it passed!! What a great Kata!!
    Suffered, but learned a bit,
    And asusual, some Awesome code are already in the solution page,
    some i understand, and some i don't.
    Alhamdulillah!! Thanks You Madjosz!!!

  • Custom User Avatar

    It's just how you calculate your sum. Fraction is too inefficient. Get rid of it and your solution passes.

    Edit: Ok, reading Discord indeed floating point calculation were your prior problem, since they can store up to 16 digits exactly.

  • Default User Avatar

    can there be problem after 16th or 17th digits? i dont understand??!! Anyone help?

  • Default User Avatar

    I did exactly that, O(1) for one prime and using inclusion-exclusion means that I have to do that binom(n, k) times for 1 <= k <= n.
    I pass 6 out of 6 30 digits tests but then my code times out. Am I still missing something?

  • Custom User Avatar

    great, just solved it, thanks for the motivational speech ;)

  • Loading more items...