Ad
  • Default User Avatar

    We are mutating (reducing) the items arrays' length every time we execute splice method.
    Modulo is used to check if our index value is bigger than an arrays' length.
    If it is we just use the remainder as an index, because it goes at the begining of an array again.
    Think of it like a circle, it will go back to where it began.

  • Custom User Avatar

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