My code is passing all the given sample input test cases but it gives me a wrong answer.Could someone please tell me where I am going wrong? Thanks in advance.
Following is the link to my code : http://ideone.com/Eo8e6D
My code is passing all the given sample input test cases but it gives me a wrong answer.Could someone please tell me where I am going wrong? Thanks in advance.
Following is the link to my code : http://ideone.com/Eo8e6D
@roshi: your algorithm is incorrect and may be correct for only few cases because try this small test case:
your algorithm returns No but answer is Yes(2+3). you should find all the subsets sum from the given array and verify whether any subset sum is equal to the given amount or not if it is equal print Yes else No.
If this is helpful to you upvote and accept my answer. Thank you happy coding