Ad
  • Custom User Avatar

    can somebody explain math behind it? how did you even came up with this solution?

  • Custom User Avatar

    whatever, you were right, i was just stuck on one particular test, and after few more optimizations i finally did it T_T
    thank you for this kata, it was bothering me for 2 weeks

  • 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

    as i said, sometimes it stops on 48, sometimes on 52, with around the same 0-1ms solution per test
    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

  • 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".

  • Custom User Avatar

    got most of my tests in like 0-1 ms, with longest one ~190ms but yet timeout for some reason
    http://prntscr.com/u71s6h
    how can this be possible?

    note: its not looking like i'm stuck on some particular test, it just drops on ~48-52 randomly