Hash the array of numbers. Creation of the hash table is O(n) with the key being the same as the data. Iterate over the array and check if data+k at index[i] is there in the hash. If found, increment count.