Input: N = 5, K = 3, S = 20, arr[] = {4, 6, 8, 2, 12}
Output:
{6, 2, 12}
Explanation:
Only one subsequence of size 3 with a sum 20 is possible i.e., {6, 2, 12} and sum is 6 + 2 + 12 = 20
Input: N = 10, K = 5, S = 25, arr[] = {2, 4, 6, 8, 10, 12, 1, 2, 5, 7}
Output:
{10, 1, 2, 5, 7}
{4, 8, 1, 5, 7}
{4, 8, 10, 1, 2}
{4, 6, 12, 1, 2}
{4, 6, 8, 2, 5}
{2, 10, 1, 5, 7}
{2, 8, 12, 1, 2}
{2, 6, 10, 2, 5}
{2, 6, 8, 2, 7}
{2, 4, 12, 2, 5}
{2, 4, 10, 2, 7}
{2, 4, 8, 10, 1}
{2, 4, 6, 12, 1}
{2, 4, 6, 8, 5}