Python, two pointer, O(nlogn)
\ndef find_pairs(L: List[int], k: int) -> int:\n    """\n    K-diff Pairs in an Array\n\n    time: O(nlogn)\n    space: O(1)\n\n    :param List[int] L:\n    :pa
```\ndef find_pairs(L: List[int], k: int) -> int:\n    """\n    K-diff Pairs in an Array\n\n    time: O(nlogn)\n    space: O(1)\n\n    :param List[int] L:\n    :param int k:\n    :return int:\n    """\n    L.sort()\n\n    N = len(L)\n\n    i = pairs = 0\n    j = 1\n\n    while j < N:\n        if j < N - 1 and L[j] == L[j + 1]:\n            j += 1\n\n        elif L[j] == L[i] + k:\n            pairs += 1\n            i += 1\n            j += 1\n\n        elif L[j] > L[i] + k:\n            i += 1\n\n        elif L[j] < L[i] + k:\n            j += 1\n\n        j = max(j, i + 1)\n\n    return pairs\n```
['Two Pointers', 'Python', 'Python3']