The solution is so simple. We gonna iterate through the array and for each element (i) in the array we gonna check the difference between k and the element (i) present in the hashing table or not.
If the difference (k-i) is present then it means that current element (i) and the difference (k-i) sums to form k. So we are printing the pair.
If the key is not present we are inserting the element (i) to the hashing table.
Hope you got it. If you didn’t, hold on.
Pseudocode