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.
This comment is hidden because it contains spoiler information about the solution
author managed to solve the kata and the description mentions that one should not attempt to mutate the nodes
That won't work because that's not quite how that function works. But to be fair it's not the most efficient solution to find the next prime. But this doesn't test for a lot of primes or very large ones so this solution suffices.
EDIT: I guess I could do that if I change one other thing. Since all the tests test for more than one prime I could do something like this:
Though it's a bit convulted. ¯\(ツ)/¯
Reference solution inside the tests completes 100 random tests in around 6 seconds. If you implement something similar, it's on the edge of the 12 second limit.
Description updated.
Not an issue.
Fixed
I use something faster than O(N^2) but it does not pass. How much time does your solution take to complete?
I completed this kata. If it helps, analyze your algorithm. You need something faster than O(n^2).
10 people have completed this kata. We all had the same tests. You cant console log a 100k element array. Make sure you can pass the example test cases and then figure out how to deal with it when it scales.
This comment is hidden because it contains spoiler information about the solution
Marked as resolved
Oh, right: I missed that, fixed!
I don't get what you mean in the first sentence, fixed the second.
The submit test will run a second time ,you can console total to see it .
Loading more items...