Ad
  • Default User Avatar

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

  • Custom User Avatar

    so it looks more like it loads something for the first 11+ seconds, and then runs my code for 0.5 last seconds, and not being able to complete all the tests

    This is not true. I just ran the tests on my reference solution a couple times and it completed in less than 2 seconds each time. I'm not sure why your code is not passing, but here's some info about the random tests -- there are 3 groups of random tests, each running 20 individual tests each. With each successive test group, the typical size of the grid tested increases. The 3rd group runs tests for sizes of up to 24 x 24.

    It might be an optimization problem, or it might be something else.

    EDIT: try doing a console.log of the last test that times out, copy that test case and try debugging by running your solution against that test case locally (on your machine). Look out for non-terminating while loops.

  • Custom User Avatar
  • Custom User Avatar

    It's possible if initial 50 cases represent some data scenario, and 51st test case represents another scenario which is not handled well by your solution. Did you try to check if timing out test case can indeed be solved by your solution efficiently? Remember that in case of timeout, all your non-flushed logs can be lost, so make sure to flush all your prints explicitly.

    For now I am going to close your issue as unconfirmed, feel free to reraise it if you can come up with more details about the error in the kata than just "my solution fails".