I have a similar problem but in this case both numbers ARE prime. I double checked.
(6, 100, 110)
101 is a prime number.
101 + 6 = 107
107 is also a prime number
My function is returning [ 101, 107 ] (both prime numbers between 100 and 110 with an interval of 6).
Still, the kata points an error "expected [ 101, 107 ] to deeply equal null".
I dont understand :(
Just figured it out. There can be no primes in between.
Sorry
I'm having the same issue, for some reason the console.log shows that [1, 2, 5] is being passed as the coinDenominations. Only when I console.log it with nothing else on the function does it show as [1,2,5,10,20,50]
the problem in your code is that Array.splice() is inefficient for very large arrays, because it has to shift all of the indexes to the right of the deleted element. so, calling it in a loop is slow.
Note: due to the randomness of the tests it is possible that you will get unlucky and a few of the tests will be really large, so try submitting 2 or 3 times.
This comment is hidden because it contains spoiler information about the solution
I have a similar problem but in this case both numbers ARE prime. I double checked.
(6, 100, 110)
101 is a prime number.
101 + 6 = 107
107 is also a prime number
My function is returning [ 101, 107 ] (both prime numbers between 100 and 110 with an interval of 6).
Still, the kata points an error "expected [ 101, 107 ] to deeply equal null".
I dont understand :(
Just figured it out. There can be no primes in between.
Sorry
361 isn't prime, it is evenly divisible by 19.
I'm having the same issue, for some reason the console.log shows that [1, 2, 5] is being passed as the coinDenominations. Only when I console.log it with nothing else on the function does it show as [1,2,5,10,20,50]
Not an issue, it's only available in Node 14. or above
the problem in your code is that
Array.splice()
is inefficient for very large arrays, because it has to shift all of the indexes to the right of the deleted element. so, calling it in a loop is slow.Probably, yes.
Check that too ^
Because
replaceAll
doesn't work in all Node's versions.