Ad
  • Custom User Avatar

    Thanks for the recommendation Jomopipi! The naive solution is pretty good. I'll need to take another look to make sure I get good takeaways from some of what you implemented there. It's a lot more concise than I thought the approach would be.

    I ran away from your approach because I hit a timeout with an even more naive solution and I wasn't quite sure how large the test inputs were. Do you know if there is a way to tell what the input was when the outcome of a test is a timeout?


    Fair point, Kayleigh - I don't think you need a maths background. My frustration was borne from having went at the problem very inefficiently at first and not being sure how efficient I had to be, hence resorting to mathematical simplification and being miffed for feeling like I had to do so. If you have any recommendations for kata or resources on DSA, I'd definitely take a look!

  • Custom User Avatar

    I think my solution is pretty naive if you want to check it out.

  • Custom User Avatar

    Should we mention that the base must be postive? 7 in base -3 is 111.

    (-3)**2 + (-3)**1 + (-3)**0 = 9 + -3 + 1 = 7

  • Custom User Avatar

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

  • Custom User Avatar

    OCaml translation

    Uses regular OCaml int because by the time I realised that the Python test gen was messed up I had essentially finished writing the entire thing.

    I can switch to mpz bigints if we really want this to be hard.

  • Custom User Avatar

    Python tests produce inputs much larger than Number.MAX_SAFE_INTEGER.

    Ordinarily I wouldn't raise this but it's very clearly intended that they don't do this when you conisder that Number.MAX_SAFE_INTEGER is inlined as a constant in said tests.

  • Custom User Avatar

    You don't need a maths background for this if you happen to be a bit observant and are familiar with dsa.

    If the inputs were a couple orders of magnitude larger then you would need one.

  • Custom User Avatar
  • Custom User Avatar

    Having completed this kata, I'll just say that it's important to have very good math skills. Yes, many coding problems involve math, but since the test numbers are so large, it's necessary to know how to use mathematical shortcuts to solve this.

    Feel free to look at my answer if you want a full breakdown. This was the first 4 kyu I have tried and I have a feeling things are only going to get more logically intense from here on out.

  • Custom User Avatar

    My fix has landed so this should no longer happen.

  • Custom User Avatar

    how js assert?

  • Custom User Avatar

    I've put up a translation that replaces the reference implentation with one that works, please review!

  • Custom User Avatar

    Thanks for posting this! Indeed, retrying a few times got me past the hurdle.

    I'll have to look into why this happens, it looks like a bug in the reference solution.

  • Custom User Avatar

    Still not resolved. In the rust test cases, I got
    17700847248605297701 (should be 84)
    17393337673075145131 (should be 254).
    Had to special case those to submit, but the test cases should be fixed.

  • Custom User Avatar

    not a kata issue

  • Loading more items...