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.
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.
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.
you need to return true or false from the function, hence the ===