maximum no. of elements in an array having sum less than or equal to k
<p>I want to find the maximum no. of elements in a given positive integer array such that their sum is less than or equal to a given no. k. For example, I have an array </p>

<pre><code>[3,4,7,2,6,5,1] and k=6;
</code></pre>

<p>The Answer is 3 as 1,2,3 are maximum elements to give sum 6. </p>