Ad
  • Default User Avatar

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

  • Default User Avatar

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

  • Default User Avatar

    FYI, I just reran one of my past solutions, which completed the 200 tests in less than a second on the server.

  • Custom User Avatar

    I wonder what we two do differently, because first of all, Python 3.8 version is unavailable for me here on CW, I can select only 3.6. When I do so, I submit following dummy solution:

    def tower(base, h, m):
        return 1
    

    what obviously makes all tests fail, but it gives some potentially useful output which I pasted here. It's not really interesting except last ~30 cases with big numbers, which you could use for benchmarking.

    Unfortunately I haven't solved the kata yet so I won't ask you for your code, but if your benchmarks run locally on above inputs efficiently but still timeout on CW, you might want to ask for help on kata solving channel.

  • Custom User Avatar

    I have not solved the kata in Python, but you could try following things:

    • first, return some dummy value from your function (for example, return 1 should do). All tests will fail, but you will see how many of them is there and what are parameters used. As far as I see, there's 200 test cases.
    • check your solution locally for similar amount of tests with similar parameters. Measuring your solution only once is not very relevant, your solution might be fast for this one particular input, but could be sloooow for other inputs.
    • If test title does not show parameters, you can print them, and then recreate problematic cases locally to see if your solution handles them efficiently.
  • Custom User Avatar

    because in that kata, the restriction aren't the same, that's all. Those are "anti-cheat" measures (not powerful ones...). So what's allowed or not depends on who implemented the restrictions.

  • Custom User Avatar

    Because it's not easy to find out if it's in a comment or not, so it's forbidden everywhere.

  • Custom User Avatar

    that's because you wrote "code" somewhere in your solution. Possibly in a comment or as part of something else. And that's forbidden by the restrictions.

  • Custom User Avatar

    nothing is broken, the module is already imported in the preloaded part, that's all.

  • Custom User Avatar

    You can see test inputs by printing them, see this paragraph of the FAQ. Hopefully this will help you to find out why your solution returns None sometimes.

  • Custom User Avatar

    This solution is probably older than two months. It's possible it was submited when only Python 2 was available on CW, and there were no Python 3. Now Python 2 is not available anymore, and solutions using Python 2 cannot be submitted.

    Solutions from old language versions are not automatically invalidated, that's why you can still see them and they still attract upvotes.

  • Default User Avatar

    There is something called python 2. Also, it is invalidated

  • Custom User Avatar

    Why not post it on kata's discourse? This is completely off-topic...

  • Custom User Avatar

    Your function should return the result instead of printing it.