Ad
  • Custom User Avatar
  • Custom User Avatar

    What you can do is use .slice() on the array when assinging it at the begining. I think this should make a proper copy of the object.

  • Custom User Avatar

    You're changing the original arrays, and that's messing with the tests.
    If you print out a1 and a2 at the end, you'll see that they've changed.
    If you really want to change the arrays, you'll have to deepcopy them. This is because an array in JavaScript is also an object and variables only hold a reference to an object, not the object itself. Thus both variables have a reference to the same object - if you change one, the other will change too.

  • Custom User Avatar

    Yeah, I'm not sure then.
    It may be because you might be changing the original array.
    It works fine in JS for me.
    Could you post your code here and mark it as a spoiler so I could take a look?

  • Custom User Avatar

    JS is fine. You can see that there are 806 JS completions.
    It the description, it says If a1 and/or a2 are empty return -1. Only one array needs to be empty.

  • Custom User Avatar

    which language?