Ad
  • Custom User Avatar

    Oh, I was just playing with tests, you can choose different ranges. I just wanted to have consistent results, that's why I limited the value to 10 or 11.
    Using sets helps for merging in this case, yes, but also checking if an element is included in a set is O(1), while checking if an element is included in a list is O(n).
    You can read here more about time complexities in python (that's how I learned as well at the beginning): https://wiki.python.org/moin/TimeComplexity

  • Custom User Avatar

    Hello, you can deepcopy the array first before giving it to the user. Or, you can run the reference solution first and then match the user solution from the run (if you're sure the reference solution doesn't modify the input as well).

    That way, the user won't be able to modify the input array.