title: Variant of Subset-Sum
body: <p>Given <code>3</code> positive integers <code>n, k, and sum</code>, find exactly <code>k</code> number of distinct elements <code>a_i</code>, where<br>
  <code>a_i \in S, 1 &lt;= i &lt;= k, and a_i \neq a_j for i \neq j</code><br>
  and, <code>S</code> is the set<br>
  <code>S = {1, 2, 3, ..., n}</code><br>
  such that<br>
  <code>\sum_{i=1}^{k}{a_i} = sum</code><br>
  I don't want to apply brute force (checking all possible combinations) to solve the problem due to exponential complexity. Can someone give me a hint towards another approach in solving this problem? Also, how can we exploit the fact the set <code>S</code> is sorted?
  Is it possible to have complexity of <code>O(k)</code> in this problem?</p>