Please help! What's the logic behind this problem?

problem link - https://www.codechef.com/UICC2019/problems/RUSH03
how to solve it??

Hi Lakshay, This is a easy problem.
You need to find k values out of n whose sum will give S.
Here, N<=20 So you can use BruteForce.
Firstly Find all subsets of size K from N values and check if any one will give sum S , If yes then Print those K values.
Just find All subset Using Recursion.
Hit like if u get it :slight_smile:

If u got stuck in code then reply here.