Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
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 likefindHighestValue()
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.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.
This comment is hidden because it contains spoiler information about the solution
Why
m = (m - last) / 10 - 2last
instead of
m = m / 10 - 2last ?
Sustraction of last digit does not make sense as this digit dissapears after dividing by 10.
ok, I got it.
I don't understand first two lines of isPrime function:
if n <= 3:
return n >= 2
Dear colleagues, can you help me understand those?
you need to return true or false from the function, hence the ===
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?