It's not so much about exactly how many decimals, it's about whether it is a valid solution or not. It simply doesn't seem okay to allow for any solution to sometimes pass a kata.
memory[memIndex] ==0?leftBrackets.shift() : i=leftBrackets[0]
if (leftBrackets.length==0) {skip=false}
The first line is wrong as the latest bracket is currently on the last index. The second line is also wrong as when the code is something like this: +[-[-]>+<]>. this will result in 0 instead of 1 since the state skip from inner bracket still holds.
Yes, this type of floating point verification is asking for such issues:
Instead, a tolerance of
1e-6
should be used.isn't this possibly an
issue
?This comment is hidden because it contains spoiler information about the solution
This is like a 5-6 kyu just to understand it...
Geezus
It's not so much about exactly how many decimals, it's about whether it is a valid solution or not. It simply doesn't seem okay to allow for any solution to sometimes pass a kata.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Oops sorry, I didn't notice I made the same mistake twice in one line... SHOULD be fixed now...
i = leftBrackets[0]
is wrong because, again, the latest bracket is the last item of the array.I believe it should work now. Thanks for noticing that!
In the memory cells usage checks:
The first line is wrong as the latest bracket is currently on the last index. The second line is also wrong as when the code is something like this:
+[-[-]>+<]>.
this will result in 0 instead of 1 since the stateskip
from inner bracket still holds.It should be fixed. It wasn't accounting for inputs in the memory check.
My solution uses 3 memory cells and passes all tests.
Fixed!
Loading more items...