Subset Sum Easy 1

I am getting wrong answer,my code is at:

Hello @gyrsh,

Don’t you think it is weird that your code is working correct for sample testcase.
And i am sure that you must have tried some by yourself also.
If didn’t, then i would suggest you start doing it from next time as it helps you to understand the question better and very helpful for debugging the code.
It must be working correct for those also.

This is because the logic of your code is correct but the way you are printing output is not correct.
Your code’s output format doesn’t match with the output format of question.

Modification:
(check(a,0,n-1,n-1)==1)?cout<<“Yes”<<endl:cout<<“No”<<endl;

Hope, this would help.
Give a like, if you are satisfied.