It doesn't says both are valid, it says one digit can belong to two adjacent digit-pairs.
We define a digit-pair as: Two digits with at least one question mark between them.
Your task is to check if there are exactly 3 question marks between every digit-pair and their sum equals to 10. If so, return true, otherwise return false.
For that string your code should return false, as the similar sample test shows.
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
This means you are using too much memory (you are probably building a gigantic array or something like this, or a part of your code keeps pushing value into something and never stops), and it is not a kata issue.
Advice: your while loop is probably the culprit. You are probably not testing your code with the same input in VSC as here. Please refer to the documentation: https://docs.codewars.com/training/troubleshooting/
It doesn't says both are valid, it says one digit can belong to two adjacent digit-pairs.
For that string your code should return false, as the similar sample test shows.
I solved the kata in JavaScript, so I am able to see your code. Your code passes the first sample tests, but fails in some of the series
for example
I don't think it works fine in VSC either.
This means you are using too much memory (you are probably building a gigantic array or something like this, or a part of your code keeps pushing value into something and never stops), and it is not a kata issue.
Advice: your
while
loop is probably the culprit. You are probably not testing your code with the same input in VSC as here. Please refer to the documentation: https://docs.codewars.com/training/troubleshooting/