I know that when asked to find two elements whose add up to a given number then the solution can be obtained in `O(n)` time, namely by making a hashmap and when iterating over the list, simply find an element such that `a[j]=S - l[i]`. I want to be able to generalize this to `K` distinct elements. How would i approach such a problem? Recursively, nested loops? I'm assuming that the best complexity in this case will be `O(n^{k-1})`, is this intuition also correct?