Ad
  • Default User Avatar

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

  • Default User Avatar

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

  • Custom User Avatar

    s is the input array converted to set for efficiency. The return line does exactly what the specifications say:

    1. Finds all numbers x for which x + 2 exists in the input array
    2. Sorts the found numbers
    3. Constructs an array where each element is a pair of the form {x, x + 2}

    If you need an explanation about how the used classes/methods work, you can look up the documentation yourself instead of discussing spoilers here.