Ad
  • Custom User Avatar

    I'm a little lost with your code; I don't see the memoryAlloc function anywhere here so I don't know where you're trying to start executing without really reading it all over. Also, you're doing a couple things like findHighestValue() which isn't necessary; it's true that using built-in methods for finding the max in JS is slower than writing one yourself, but here it isn't necessary. If you're timing out even on the first test, it's very likely you're running into an infinite loop somewhere.

  • Custom User Avatar

    This code must be a joke. You're reinventing the wheel with every helper function, using wrong comparison operator, it can't pass the sample tests (which are obviously a part of main test suite); damn, it can't even pass 15(!) random tests out of 250.

    I can see you trying to do it the right way, but this is a disaster.

  • Custom User Avatar

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

  • Custom User Avatar

    Why
    m = (m - last) / 10 - 2last
    instead of
    m = m / 10 - 2
    last ?
    Sustraction of last digit does not make sense as this digit dissapears after dividing by 10.

  • Custom User Avatar
  • Custom User Avatar

    I don't understand first two lines of isPrime function:
    if n <= 3:
    return n >= 2
    Dear colleagues, can you help me understand those?

  • Custom User Avatar

    you need to return true or false from the function, hence the ===

  • Custom User Avatar

    Great code. I am trying to learn and I have a question: why you have added %1 === 0? Wouldn't it work without this part of code?