"""Codewars: Difference of 2
6 kyu

URL: https://www.codewars.com/kata/5340298112fa30e786000688/

The objective is to return all pairs of integers from a given collection
of integers that have a difference of 2.

The result should be sorted in ascending order.

The input will consist of unique values. The order of the integers in the
input collection should not matter.

Examples
[1, 2, 3, 4]      -->  [[1, 3], [2, 4]]
[4, 1, 2, 3]      -->  [[1, 3], [2, 4]]
[1, 23, 3, 4, 7]  -->  [[1, 3]]
[4, 3, 1, 5, 6]   -->  [[1, 3], [3, 5], [4, 6]]
"""


def twos_difference(lst): 
    pass


def main():
    pass


if __name__ == '__main__':
    main()

@@ -570,41 +570,782 @@
 st):
- %0A    pass%0A%0A%0Adef main():%0A    pass
+%0A    %22%22%22%0A    Time complexity: O(nlogn).%0A    Space complexity: O(n).%0A    %22%22%22%0A    lst_set = set(lst)%0A    diff2 = %5B(i, i + 2) for i in lst if i + 2 in lst_set%5D%0A    return sorted(diff2)%0A%0A%0Adef main():%0A    assert twos_difference(%5B1, 2, 3, 4%5D) == %5B(1, 3), (2, 4)%5D%0A    assert twos_difference(%5B1, 3, 4, 6%5D) == %5B(1, 3), (4, 6)%5D%0A    assert twos_difference(%5B0, 3, 1, 4%5D) == %5B(1, 3)%5D%0A    assert twos_difference(%5B4, 1, 2, 3%5D) == %5B(1, 3), (2, 4)%5D%0A    assert twos_difference(%5B6, 3, 4, 1, 5%5D) == %5B(1, 3), (3, 5), (4, 6)%5D%0A    assert twos_difference(%5B3, 1, 6, 4%5D) == %5B(1, 3), (4, 6)%5D%0A    assert twos_difference(%5B1, 3, 5, 6, 8, 10, 15, 32, 12, 14, 56%5D) == %5B(1, 3), (3, 5), (6, 8), (8, 10), (10, 12), (12, 14)%5D%0A    assert twos_difference(%5B1, 4, 7, 10%5D) == %5B%5D%0A    assert twos_difference(%5B%5D) == %5B%5D
 %0A%0A%0Ai

Complete cw_difference_of_2.py