Ad
  • Custom User Avatar

    I used that same algorithm, just need to tweak for the general case.

  • Default User Avatar

    There are both recursive solutions and iterative solutions. Maybe recursion is simpler (but keep an eye on performance).

  • Default User Avatar

    Your code changes the content of the arrays x, y, px, and py. 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.

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    I have the same problem, i pass all the tests but get a SystemStackError

  • Default User Avatar

    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.