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.
Thanks @JorgeVS! Your pointer to read comments helped nailing the problem. But I must say, it is peculiar to take coder's own encode method and use it to feed in decoding.
Hey @JorgeVS, I am too at the same issue. Any pointers what am I missing?
you're wrong:
the 0 here is the value under the pointer, not the "address of the pointer in the tape". So
if '[' was encountered at 0
, the value under the pointer IS 0 and you effectively move forward in any case.As per the description it says, ']' - Jump back to matching [ (if value at current cell is nonzero). The statement in bracket 'if value at current cell is nonzero' is not correct. If we encounter ']' we need to always return back to matching '['.
Consider a scenario where matching '[' was encountered at 0 and current pointer is at non zero it needs to move forward.
When splicing, it will change the original array and that in my opinion is a negative side effect of the function.
This comment is hidden because it contains spoiler information about the solution