Hi,
I looked at your sample question, and it seems very easy. The first solution that comes to mind is to sort the array, then step through the array with 2 pointers. Increment the right pointer until sum > K, then increment left pointer until sum <=K, and have a simple counter variable to keep track of how many times the sum = K. It's O(n*log n) time and O(n) space as required.
Was that an easy, medium or hard problem? Can you please give me additional details on this project?