Ad
  • Default User Avatar

    Was happy to find a working solution without any mathematical web search(using binomial coefficients), but it was far too slow, even after a lot of optimalization.
    After losing a lot of time, tried a few different algorithms only to find out, that none of them was fast enough.
    After even more search, found out what you ment by "use matrices", it should me more that a hint, you are very unlikely to find a different solution that does not time out.
    Which is very unsatisfying, since the problem could be solved in numerous interesting ways(not to mention ways you can come up with on your own, without reading pdfs), would it not include such huge numbers.

  • Default User Avatar

    Was struggling with the same problem for a good few hours...

    Like @K01egA mentioned above it might be a problem with the input values, sure was the problem in my case

  • Default User Avatar

    The numbers of tests can vary, from my experience in Python there are about 650-720 tests.

  • Default User Avatar

    Great Kata !
    I remember not being able to solve it a year ago, back while coding in C++.
    Although i usually don't have big troubles with 5 kyu math type katas, here smoehow the math part was a little tricky for me.
    After a year of break, now in Python, somehow had better luck with this one :D

  • Default User Avatar

    Now debugged with some prints ....
    My code needs to be cleaned a bit ...
    Thanks for the kata

  • Default User Avatar

    Thks
    I added a test case and I am in an infinite loop :-(
    So I added some prints in the code to understand , but not found for the moment

  • Default User Avatar

    Hi,
    had the same problem. You might wanna try setting up a timer in the function and use an if statement to return your result vector after a given amout of time passes, so you would know where your algo gets stuck. You could also gain some insight by using the same timer to measure the average time your algorithm needs to solve one case

  • Default User Avatar

    Hi
    Please could you check if my timeout is only inefficiency or an infinite loop in the attempt tests
    and if inefficiency, is it linked to the use of too many methods or just messy implementation ?

    Thanks in advance

  • Default User Avatar

    After some tampering, my first solution that got all the test cases right, passed almost all the other cases, except some random ones and the "full up, full down" one. Was searching for almost an hour, and could not find where the algorithm was wrong. Only later did i discover that i mistakenly put an "is greater" instead of "is greater or equal" operator in a for loop with a lengthy continuation condition.
    Great Kata, had lots of fun :D

  • Default User Avatar

    Nice solution too. Much shorter than my cpp solution.

  • Default User Avatar

    It looked easy, after a short while I wrote down a quick algorithm to calculate the exact number, and then i realised that we are counting all the digits in a number, not only the number. 2 days later after some ridiculous amout of debugging, finally got it right. Really nice Kata