Question: Sum of minimum number of elements equal to or greater than K(you can use the elements as many times as they are given in array)

Question: Sum of minimum number of elements equal to or greater than K(you can use the elements as many times as they are given in array).
Input:first line contains n and k,second line contains n number of elements. 6 15 2 4 5 6 7 8
ans : 2
explanation : 7+8=15 i.e minimum no of elements. also 4+5+6 =15 but minimum no is 2 (7,8)

help me with the code, I am not able to get correct ans

Hello @samardeep do you want code for this question?
or how can i help you?

Code for the question

Please reply, i dont understand the approach

Hello @samardeep please wait i am giving yout the code for the same:

@samardeep chek this :


if you have any doubt you can ask here:
Happpy Learning!!

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.