Ad
  • Custom User Avatar

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

  • Custom User Avatar

    Shouldn't be any issue with modifying the given parameter as we are told that we "can assume that all inputs are valid integers".

    From MDN:
    "Parameters are essentially passed to functions by value — so if the code within the body of a function assigns a completely new value to a parameter that was passed to the function, the change is not reflected globally or in the code which called that function.

    When you pass an object as a parameter, if the function changes the object's properties, that change is visible outside the function."