Input [1, 5, 2, 2, 2, 5, 5, 4] K = 3, i = 0, j = 7 Algo p−q=diff p−diff=q def find_KDiff_Pair(arr, K): for num in arr: if binarySearch(arr, size(arr), num - K): # We have a Count Time Complexity O(n logn)