Ad
  • Default User Avatar

    That does work and is quite a bit nicer, but the original problem statement said to create a copy of the array. That's a pretty pointless condition that doesn't even get tested though, so the default arguments should probably be used in a slightly tweaked better version of this Kumite.

  • Custom User Avatar

    You can use
    function insertionSort(arr, i = 1, j = 1)
    and you would be skipping the first if.

  • Custom User Avatar

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