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.
I used that same algorithm, just need to tweak for the general case.
There are both recursive solutions and iterative solutions. Maybe recursion is simpler (but keep an eye on performance).
Your code changes the content of the arrays
x
,y
,px
, andpy
. Arrays in Javascript are passed by reference, so this can cause problems if the code that called your function needed that data for other purposes.I've just tweaked the test setup so that it doesn't use those arrays for anything after calling your function; your solution should pass now.
In general, though, if you are passed an array, it's safest to avoid changing its content unless you know for sure that it's not being used anywhere else.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
I have the same problem, i pass all the tests but get a SystemStackError
Please check your code. If you need help with it, please post it as a Question, not an Issue. The Kata is Ok. Please check how many solutions have passed in JS.